Here is the full code:
[code] app.ExcelWordRunning = True
MakeSheetIndex(True)
Dim oword As wordapplication
Dim odoc As WordDocument
dim otable as WordTable
dim oPara4 as WordParagraph
dim oRng as WordRange
dim WrdSel as WordSelection
oword = New wordapplication
oword.visible = True
oDoc = oWord.Documents.Open("H:\\Templates\\Forms - Logo.dotx")
oTable = oDoc.Tables.Add(oDoc.Bookmarks.Item("\\endofdoc").Range, 2, 2)
oTable.Rows.Item(1).Range.Font.Bold = True
oTable.Rows.Item(1).Range.Font.Name = "Arial"
oTable.Rows.Item(1).Range.Font.Size = 12
oTable.Rows.Item(2).Range.Font.Bold = True
oTable.Rows.Item(2).Range.Font.Name = "Arial"
oTable.Rows.Item(2).Range.Font.Size = 12
oTable.Range.ParagraphFormat.SpaceBefore = 24
oTable.Cell(1, 1).Range.Text = "Transmittal"
Dim Today as new date
oTable.Cell(1, 2).Range.Text = "Date: " + str(Today.Month,"00") + "/" + str(Today.Day,"00") + "/" + Str(Today.Year,"0000")
oTable.Cell(1, 2).Range.ParagraphFormat.Alignment = Office.wdAlignParagraphRight
oTable.Cell(2, 1).Range.Text = "Delivered by "
oPara4 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\\endofdoc").Range)
oPara4.Range.InsertParagraphBefore()
oPara4.Range.Text = ""
oTable = oDoc.Tables.Add(oDoc.Bookmarks.Item("\\endofdoc").Range, 6, 4)
'MsgBox("0")
oWord.ActiveDocument.Tables(1).Select_
oWord.ActiveDocument.Tables(1).Columns.Item(1).SetWidth(37, Office.wdAdjustNone)
'oTable.Cell(1, 1).SetWidth(37, Office.wdAdjustNone)
'oTable.Columns.Item(1).SetWidth(37, Office.wdAdjustFirstColumn)
'MsgBox("1")
oTable.Range.ParagraphFormat.SpaceAfter = 6
oTable.Cell(1, 1).Range.Text = "To:"
otable.Cell(1, 2).Range.Text = SentTo
oTable.Cell(1, 3).Range.Text = "Phone No.:"
oTable.Cell(1, 4).Range.ParagraphFormat.Alignment = Office.wdAlignParagraphRight
'oTable.Cell(1, 4).Range.Text = Phone.Text
'oTable.Cell(1, 2).Range.Text = Company.Text
oTable.Cell(1, 2).Range.Font.Bold = True
'oTable.Cell(1, 2).SetWidth(200, Office.wdAdjustNone)
oWord.ActiveDocument.Tables(1).Columns.Item(1).SetWidth(200, Office.wdAdjustNone)
'oTable.Columns.Item(2).SetWidth(200, Office.wdAdjustFirstColumn)
'MsgBox("2")
'oTable.Cell(2, 2).Range.Text = Address1.Text
'If Address2.Text <> "" Then
'oTable.Cell(2, 2).Range.Text = oTable.Cell(2, 2).Range.Text & Address2.Text
'End If
'oTable.Cell(2, 2).Range.Text = oTable.Cell(2, 2).Range.Text & City.Text & ", " & State.Text & " " & Zip.Text
oTable.Cell(3, 1).Range.Text = "Attn:"
oTable.Cell(3, 2).Range.Text = SentTo
oTable.Cell(4, 1).Range.Text = "Re:"
oTable.Cell(4, 2).Range.Text = pName.Text.Titlecase
oTable.Cell(4, 3).Range.Text = "Project No.:"
oTable.Cell(4, 4).Range.Text = pno.Text.Uppercase
oTable.Cell(4, 4).Range.ParagraphFormat.Alignment = Office.wdAlignParagraphRight
oTable.Borders.Enable = True
For r as integer = 1 To 6
For c as integer = 1 To 4
If r = 5 Then
oTable.Cell(r, c).Range.Font.Size = 1
oTable.Cell(r, c).Range.ParagraphFormat.LineSpacing = 1
oTable.Cell(r, c).Range.Borders.InsideLineStyle = Office.wdLineStyleNone
oTable.Cell(r, c).Range.Borders.OutsideLineStyle = Office.wdLineStyleNone
oTable.Cell(r, c).Range.Font.Name = "Arial"
Else
oTable.Cell(r, c).Range.Font.Size = 12
oTable.Cell(r, c).Range.ParagraphFormat.LineSpacing = 15
oTable.Cell(r, c).Range.Borders.InsideLineStyle = Office.wdLineStyleNone
oTable.Cell(r, c).Range.Borders.OutsideLineStyle = Office.wdLineStyleNone
oTable.Cell(r, c).Range.Font.Name = "Arial"
End If
Next
Next
oTable.Rows.Item(1).Range.Borders(Office.wdBorderTop).LineStyle = Office.wdLineStyleSingle
oTable.Rows.Item(1).Range.Borders(Office.wdBorderTop).LineWidth = Office.wdLineWidth225pt
oTable.Rows.Item(4).Range.Borders(Office.wdBorderBottom).LineStyle = Office.wdLineStyleSingle
oTable.Rows.Item(4).Range.Borders(Office.wdBorderBottom).LineWidth = Office.wdLineWidth225pt
oTable.Cell(6, 1).Range.Text = "Description:"
oTable.Cell(6, 2).Range.Text = Reason.Titlecase.trim + " Drawings"
oTable.Cell(6, 2).Range.Font.Bold = True
oWord.ActiveDocument.Tables(1).Cell(6,2).SetWidth(180, Office.wdAdjustNone)
'oTable.Cell(6, 2).SetWidth(180, Office.wdAdjustNone)
'MsgBox("3")
oWord.ActiveDocument.Tables(1).Cell(6,1).SetWidth(80, Office.wdAdjustNone)
'oTable.Cell(6, 1).SetWidth(80, Office.wdAdjustNone)
'MsgBox("4")
oTable.Range.End_ = True
oDoc.Bookmarks.Item("\\endofdoc").Range.InsertParagraphAfter()
oRng = oDoc.Bookmarks.Item("\\endofdoc").Range
oPara4 = oDoc.Content.Paragraphs.Add(oDoc.Bookmarks.Item("\\endofdoc").Range)
oPara4.Range.Font.Size = 12
oPara4.Range.Font.Name = "Arial"
oPara4.Range.InsertParagraphBefore()
'oRng.InsertAfter(ClientRequested.Text & ":")
oRng.InsertParagraphAfter()
oRng.InsertParagraphAfter()
dim txt as String = " set of "
if Copies > 1 then
txt = " sets of "
end if
dim discs as String
dim shtcount as integer = 0
while UBound(DiscCounts) >= 0
dim tmp() as String = DiscCounts(0).Split("|")
shtcount = shtcount + tmp(1).Val
if shtcount > 0 then
if discs = "" then
discs = tmp(1) + " " + tmp(0).Replace("ENERGY", "Title 24 Compliance Forms").Titlecase
else
if UBound(DiscCounts) > 0 then
discs = discs + ", " + tmp(1) + " " + tmp(0).Titlecase
else
discs = discs + " & " + tmp(1) + " " + tmp(0).Titlecase
end if
end if
end if
DiscCounts.Remove(0)
wend
dim TotalSheets as Integer = shtcount * Copies
dim TotalSqFt as Integer = TotalSheets * SqFtPerSheet
oRng.InsertAfter("Please find enclosed " + Copies.ToText + txt + discs + " for " + Reason.TitleCase + " sheets, for a total of " + TotalSheets.ToText + " sheets at " + SqFtPerSheet.ToText + " square feet per sheet, for a total of " + TotalSqFt.ToText + " square feet. Please refer to sheet index on additional pages for more details.")
oRng.InsertParagraphAfter()
oRng.InsertParagraphAfter()
oRng.InsertAfter("Should you require any further information, please contact " + App.FullName + ".")
oRng.InsertParagraphAfter()
oRng.InsertParagraphAfter()
oRng.InsertAfter("Regards,")
oRng.InsertParagraphAfter()
oRng.InsertParagraphAfter()
oRng.InsertParagraphAfter()
oRng.InsertParagraphAfter()
oRng.InsertAfter(app.FullName)
oRng.InsertParagraphAfter()
oRng.InsertAfter(app.JobTitle)
oPara4.Format.SpaceAfter = 24
oPara4.Range.InsertParagraphAfter()
WrdSel = oWord.selection
odoc.Content.InsertAfter chr(11) + chr(11)
oWord.selection.endkey(6)
oword.Selection.InsertNewPage
oWord.selection.endkey(6)
oword.Selection.InsertParagraphAfter()
oword.Selection.Paste
dim c as new Clipboard
c.Text = ""
book.Close
excel.Quit
excel = nil
book = nil
oword.Selection.homekey(6)
if FolderExists(TransmittalFolder) = False then
TransmittalFolder.MakeFolder
end if
if FolderExists(TransmittalFolder) then
odoc.SaveAs(TransmittalFolder.NativePath + str(Today.year,"0000") + "-" + str(Today.Month,"00") + "-" + str(Today.Day,"00") + "_Trans - " + sentto + ".docx")
TransmittalFolder.Launch
end if
oword = nil
odoc = nil
app.ExcelWordRunning = False[/code]
I tried incorporating your changes, as you can see and it still fails.