Doung - Here is an abbreviated version of the code I am running:
Option Compare Database
Function rptWord()
Dim wdApp As Object
Dim myRange As Object
Dim myTable As Object
Dim strFilter As String
Dim fName As String
Dim message As String
Dim Response As String
Dim docFinal As Object
Dim tmpFinalDoc As String
Dim wdFname As String
'Display Windows File Save As Dialog
Specifyfilename:
strFilter = ""
strFilter = ahtAddFilterItem(strFilter, "Word Documents (*.doc)", "*.doc")
fName = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, _
FilterIndex:=3, _
OpenFile:=False, _
FullPath:=True, _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_HIDEREADONLY, _
DialogTitle:="Specify the folder and file name to save the
Document", _
FileName:="Application.doc")
If fName = "false" Then
Err.Number = 32755
GoTo Err_rptWord
End If
message = "Document will be saved in the following folder: " & vbCrLf &
MyCurDir
Response = MsgBox(message, vbOKCancel, "File Location")
If Response = vbOK Then
wdFname = fName
Else
GoTo Specifyfilename
End If
' Create new hidden instance of Word.
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
Set docFinal = wdApp.Documents.Add
docFinal.PageSetup.Orientation = wdOrientPortrait
docFinal.PageSetup.DifferentFirstPageHeaderFooter = False
docFinal.PageSetup.LeftMargin = wdApp.InchesToPoints(0.5)
docFinal.PageSetup.RightMargin = wdApp.InchesToPoints(0.5)
docFinal.PageSetup.TopMargin = wdApp.InchesToPoints(0.5)
docFinal.PageSetup.BottomMargin = wdApp.InchesToPoints(0.5)
docFinal.SaveAs FileName:="" & wdFname & "", FileFormat:=wdWordDocument
'Activate the current window
tmpFinalDoc = GetFileName(wdFname)
wdApp.Windows(tmpFinalDoc).Activate
Set myRange = wdApp.Selection.Range
Set myTable =
wdApp.ActiveDocument.Tables.Add(myRange, 2, 1, wdWord9TableBehavior,
wdAutoFitFixed)
myTable.Borders(wdBorderLeft).LineStyle =
wdLineStyleNone
myTable.Borders(wdBorderRight).LineStyle =
wdLineStyleNone
myTable.Borders(wdBorderTop).LineStyle =
wdLineStyleNone
myTable.Borders(wdBorderBottom).LineStyle =
wdLineStyleNone
myTable.Borders(wdBorderHorizontal).LineStyle =
wdLineStyleNone
myTable.Borders(wdBorderVertical).LineStyle =
wdLineStyleNone
myTable.Borders(wdBorderDiagonalDown).LineStyle =
wdLineStyleNone
myTable.Borders(wdBorderDiagonalUp).LineStyle =
wdLineStyleNone
myTable.Borders.Shadow = False
myTable.Rows(1).AllowBreakAcrossPage = False
'wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.Tables.Count).Rows.AllowBreakAcrossPage = False
docFinal.SaveAs FileName:="" & wdFname & "", FileFormat:=wdWordDocument
docFinal.Close
wdApp.Quit wdDoNotSaveChanges
Set docFinal = Nothing
Set wdApp = Nothing
Err_rptWord:
End Function