View Single Post
 
Old 10-15-2014, 02:06 PM
jon12355 jon12355 is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Oct 2014
Posts: 5
jon12355 is on a distinguished road
Default

I have tried to use your code on my spreadsheet but I cant get it to work

For the first part of the code I have put

Code:
Dim AppWord As Object
Dim oDoc As Object
Dim oTbl As Object
Dim oRng As Object
Dim lngIndex As Long, lngObjectives As Long
  On Error Resume Next
  Set AppWord = GetObject(, "Word.Application")
  If Err Then
      Set AppWord = CreateObject("Word.Application")
  End If
  AppWord.Visible = True
  On Error GoTo 0
  Set oDoc = AppWord.Documents.Add("Pathway to template document")

  Set oTbl = oDoc.Tables(8)
  With oTbl
    .Cell(2, 2).Range.Text = combo_Obj1_Reg.Text
    .Cell(3, 2).Range.Text = combo_Obj1_RegC.Text
    .Cell(4, 2).Range.Text = txt_Obj1Nar.Text
    .Cell(5, 2).Range.Text = txt_Obj1Sum.Text
    .Cell(6, 2).Range.Text = txt_Obj1_irr.Text
    .Cell(7, 2).Range.Text = txt_Obj1_Post.Text
    .Cell(8, 2).Range.Text = txt_Obj1_Att1.Text
    .Cell(9, 2).Range.Text = txt_Obj1_Att2.Text
    .Cell(10, 2).Range.Text = txt_Obj1_Att3.Text
  End With
In your example it looks like the next part of the code refers to coloumns, how to I write it for text and comboboxes? In the above code all the naming is the same expect obj1 is obj2.
Reply With Quote