
Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
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
> Can you post the full code from your Access procedure so that I can try the
> same thing from Access.
[quoted text clipped - 83 lines]
> >> >> >> >
> >> >> >> > Jerry
Doug Robbins - Word MVP - 31 Oct 2005 15:18 GMT
I would suggest that you continue to refer to the document as docFinal and
to the table as myTable and not switch to using ActiveDocument
Set myTable = docFinal.Tables.Add(myRange, 2, 1, wdWord9TableBehavior,
wdAutoFitFixed)
Word may be getting confused by your switching.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Doung - Here is an abbreviated version of the code I am running:
>
[quoted text clipped - 186 lines]
>> >> >> >> >
>> >> >> >> > Jerry
JWS315 - 31 Oct 2005 15:42 GMT
Changed as you suggested and used the following:
myTable.Rows(1).AllowBreakAcrossPage = False
Still get a 438 error code on the statement above...
Jerry
> I would suggest that you continue to refer to the document as docFinal and
> to the table as myTable and not switch to using ActiveDocument
[quoted text clipped - 194 lines]
> >> >> >> >> >
> >> >> >> >> > Jerry
Doug Robbins - Word MVP - 31 Oct 2005 18:47 GMT
myTable.Rows(1).AllowBreakAcrossPage = False
should be:
myTable.Rows(1).AllowBreakAcrossPages = False
Sorry I did not spot that before. But then you did not spot that I was
using:
AllowBreakAcrossPages
instead of
AllowBreakAcrossPage

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Changed as you suggested and used the following:
> myTable.Rows(1).AllowBreakAcrossPage = False
[quoted text clipped - 218 lines]
>> >> >> >> >> >
>> >> >> >> >> > Jerry
JWS315 - 31 Oct 2005 19:15 GMT
Oh what a difference 1 letter makes!! Thanks for sticking with me on this!
Jerry
> myTable.Rows(1).AllowBreakAcrossPage = False
>
[quoted text clipped - 214 lines]
> >> >> >> >> >>
> >> >> >> >> >> wdApp.ActiveDocument.Tables.Count.Rows etc.