Reply
 
Thread Tools Display Modes
  #1   Report Post  
JWS315
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

I get an error trying to set Row 1 of a 2 row table to keep from breaking
across columns - Not sure what is not correct witht code below? Error is 438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage = False

Jerry
  #2   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep from breaking
across columns - Not sure what is not correct witht code below? Error is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry



  #3   Report Post  
JWS315
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

Doug,

I tried your suggestion, however I still receive the same error. In looking
at Word VBA help it states that the AllowBreakAcrossPage property applies to
a TableStyle object, if this is the case then I would guess that I have the
wrong statement.

Any suggestions on how the code would look would be appreciated, I have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep from breaking
across columns - Not sure what is not correct witht code below? Error is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry




  #4   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

Turns out you cannot use the .Count property as I suggested. The following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages = False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same error. In
looking
at Word VBA help it states that the AllowBreakAcrossPage property applies
to
a TableStyle object, if this is the case then I would guess that I have
the
wrong statement.

Any suggestions on how the code would look would be appreciated, I have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep from
breaking
across columns - Not sure what is not correct witht code below? Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry






  #5   Report Post  
JWS315
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

Doug,

The first format of the code I was using is basically the same (I just
replaced i with the assignment) - i still get the same error - Is this
something that cannot be done on a table object? I found in the help that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I am taking the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested. The following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages = False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same error. In
looking
at Word VBA help it states that the AllowBreakAcrossPage property applies
to
a TableStyle object, if this is the case then I would guess that I have
the
wrong statement.

Any suggestions on how the code would look would be appreciated, I have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep from
breaking
across columns - Not sure what is not correct witht code below? Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry








  #6   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

Running a macro with the following code from Word itself, certainly sets
that attribute for the first row in the last table in the active document:

Dim i As Long
i = ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Rows(1).AllowBreakAcrossP ages = False

From where are you running this code? Is the table being added to the
document in the first place?

--
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

"JWS315" wrote in message
...
Doug,

The first format of the code I was using is basically the same (I just
replaced i with the assignment) - i still get the same error - Is this
something that cannot be done on a table object? I found in the help that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I am taking
the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested. The
following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages = False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same error. In
looking
at Word VBA help it states that the AllowBreakAcrossPage property
applies
to
a TableStyle object, if this is the case then I would guess that I have
the
wrong statement.

Any suggestions on how the code would look would be appreciated, I have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep from
breaking
across columns - Not sure what is not correct witht code below?
Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry








  #7   Report Post  
JWS315
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

I am running the code from an Access module, the first thing I do is add the
table then I try to set the property. I am able to do other things to the
table via Access however run into a problem when trying to set this property.
The table is a 2 row, 1 column table, nothing real elaborate.

Thanks for your help - Jerry

"Doug Robbins - Word MVP" wrote:

Running a macro with the following code from Word itself, certainly sets
that attribute for the first row in the last table in the active document:

Dim i As Long
i = ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Rows(1).AllowBreakAcrossP ages = False

From where are you running this code? Is the table being added to the
document in the first place?

--
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

"JWS315" wrote in message
...
Doug,

The first format of the code I was using is basically the same (I just
replaced i with the assignment) - i still get the same error - Is this
something that cannot be done on a table object? I found in the help that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I am taking
the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested. The
following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages = False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same error. In
looking
at Word VBA help it states that the AllowBreakAcrossPage property
applies
to
a TableStyle object, if this is the case then I would guess that I have
the
wrong statement.

Any suggestions on how the code would look would be appreciated, I have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep from
breaking
across columns - Not sure what is not correct witht code below?
Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry









  #8   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

Can you post the full code from your Access procedure so that I can try the
same thing from Access.

--
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

"JWS315" wrote in message
...
I am running the code from an Access module, the first thing I do is add
the
table then I try to set the property. I am able to do other things to the
table via Access however run into a problem when trying to set this
property.
The table is a 2 row, 1 column table, nothing real elaborate.

Thanks for your help - Jerry

"Doug Robbins - Word MVP" wrote:

Running a macro with the following code from Word itself, certainly sets
that attribute for the first row in the last table in the active
document:

Dim i As Long
i = ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Rows(1).AllowBreakAcrossP ages = False

From where are you running this code? Is the table being added to the
document in the first place?

--
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

"JWS315" wrote in message
...
Doug,

The first format of the code I was using is basically the same (I just
replaced i with the assignment) - i still get the same error - Is this
something that cannot be done on a table object? I found in the help
that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I am
taking
the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested. The
following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages = False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same error. In
looking
at Word VBA help it states that the AllowBreakAcrossPage property
applies
to
a TableStyle object, if this is the case then I would guess that I
have
the
wrong statement.

Any suggestions on how the code would look would be appreciated, I
have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep from
breaking
across columns - Not sure what is not correct witht code below?
Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry











  #9   Report Post  
JWS315
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

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


"Doug Robbins - Word MVP" wrote:

Can you post the full code from your Access procedure so that I can try the
same thing from Access.

--
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

"JWS315" wrote in message
...
I am running the code from an Access module, the first thing I do is add
the
table then I try to set the property. I am able to do other things to the
table via Access however run into a problem when trying to set this
property.
The table is a 2 row, 1 column table, nothing real elaborate.

Thanks for your help - Jerry

"Doug Robbins - Word MVP" wrote:

Running a macro with the following code from Word itself, certainly sets
that attribute for the first row in the last table in the active
document:

Dim i As Long
i = ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Rows(1).AllowBreakAcrossP ages = False

From where are you running this code? Is the table being added to the
document in the first place?

--
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

"JWS315" wrote in message
...
Doug,

The first format of the code I was using is basically the same (I just
replaced i with the assignment) - i still get the same error - Is this
something that cannot be done on a table object? I found in the help
that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I am
taking
the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested. The
following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages = False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same error. In
looking
at Word VBA help it states that the AllowBreakAcrossPage property
applies
to
a TableStyle object, if this is the case then I would guess that I
have
the
wrong statement.

Any suggestions on how the code would look would be appreciated, I
have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep from
breaking
across columns - Not sure what is not correct witht code below?
Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry












  #10   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

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.


--
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

"JWS315" wrote in message
...
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


"Doug Robbins - Word MVP" wrote:

Can you post the full code from your Access procedure so that I can try
the
same thing from Access.

--
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

"JWS315" wrote in message
...
I am running the code from an Access module, the first thing I do is add
the
table then I try to set the property. I am able to do other things to
the
table via Access however run into a problem when trying to set this
property.
The table is a 2 row, 1 column table, nothing real elaborate.

Thanks for your help - Jerry

"Doug Robbins - Word MVP" wrote:

Running a macro with the following code from Word itself, certainly
sets
that attribute for the first row in the last table in the active
document:

Dim i As Long
i = ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Rows(1).AllowBreakAcrossP ages = False

From where are you running this code? Is the table being added to the
document in the first place?

--
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

"JWS315" wrote in message
...
Doug,

The first format of the code I was using is basically the same (I
just
replaced i with the assignment) - i still get the same error - Is
this
something that cannot be done on a table object? I found in the
help
that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I am
taking
the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested. The
following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages =
False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same error.
In
looking
at Word VBA help it states that the AllowBreakAcrossPage property
applies
to
a TableStyle object, if this is the case then I would guess that
I
have
the
wrong statement.

Any suggestions on how the code would look would be appreciated,
I
have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep
from
breaking
across columns - Not sure what is not correct witht code
below?
Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry
















  #11   Report Post  
JWS315
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

Changed as you suggested and used the following:
myTable.Rows(1).AllowBreakAcrossPage = False

Still get a 438 error code on the statement above...

Jerry

"Doug Robbins - Word MVP" wrote:

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.


--
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

"JWS315" wrote in message
...
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


"Doug Robbins - Word MVP" wrote:

Can you post the full code from your Access procedure so that I can try
the
same thing from Access.

--
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

"JWS315" wrote in message
...
I am running the code from an Access module, the first thing I do is add
the
table then I try to set the property. I am able to do other things to
the
table via Access however run into a problem when trying to set this
property.
The table is a 2 row, 1 column table, nothing real elaborate.

Thanks for your help - Jerry

"Doug Robbins - Word MVP" wrote:

Running a macro with the following code from Word itself, certainly
sets
that attribute for the first row in the last table in the active
document:

Dim i As Long
i = ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Rows(1).AllowBreakAcrossP ages = False

From where are you running this code? Is the table being added to the
document in the first place?

--
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

"JWS315" wrote in message
...
Doug,

The first format of the code I was using is basically the same (I
just
replaced i with the assignment) - i still get the same error - Is
this
something that cannot be done on a table object? I found in the
help
that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I am
taking
the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested. The
following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages =
False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same error.
In
looking
at Word VBA help it states that the AllowBreakAcrossPage property
applies
to
a TableStyle object, if this is the case then I would guess that
I
have
the
wrong statement.

Any suggestions on how the code would look would be appreciated,
I
have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep
from
breaking
across columns - Not sure what is not correct witht code
below?
Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2, 1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry















  #12   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

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

--
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

"JWS315" wrote in message
...
Changed as you suggested and used the following:
myTable.Rows(1).AllowBreakAcrossPage = False

Still get a 438 error code on the statement above...

Jerry

"Doug Robbins - Word MVP" wrote:

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.


--
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

"JWS315" wrote in message
...
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


"Doug Robbins - Word MVP" wrote:

Can you post the full code from your Access procedure so that I can
try
the
same thing from Access.

--
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

"JWS315" wrote in message
...
I am running the code from an Access module, the first thing I do is
add
the
table then I try to set the property. I am able to do other things
to
the
table via Access however run into a problem when trying to set this
property.
The table is a 2 row, 1 column table, nothing real elaborate.

Thanks for your help - Jerry

"Doug Robbins - Word MVP" wrote:

Running a macro with the following code from Word itself, certainly
sets
that attribute for the first row in the last table in the active
document:

Dim i As Long
i = ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Rows(1).AllowBreakAcrossP ages = False

From where are you running this code? Is the table being added to
the
document in the first place?

--
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

"JWS315" wrote in message
...
Doug,

The first format of the code I was using is basically the same (I
just
replaced i with the assignment) - i still get the same error - Is
this
something that cannot be done on a table object? I found in the
help
that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I
am
taking
the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested.
The
following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages =
False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same
error.
In
looking
at Word VBA help it states that the AllowBreakAcrossPage
property
applies
to
a TableStyle object, if this is the case then I would guess
that
I
have
the
wrong statement.

Any suggestions on how the code would look would be
appreciated,
I
have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...
I get an error trying to set Row 1 of a 2 row table to keep
from
breaking
across columns - Not sure what is not correct witht code
below?
Error
is
438
Object does not support this property or method...

Set myRange = wdApp.Selection.Range
Set myTable = wdApp.ActiveDocument.Tables.Add(myRange, 2,
1,
wdWord9TableBehavior, wdAutoFitWindow)
wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows(1).AllowBreakAcrossPage
= False

Jerry

















  #13   Report Post  
JWS315
 
Posts: n/a
Default Error setting AllowBreakAcrossPage

Oh what a difference 1 letter makes!! Thanks for sticking with me on this!

Jerry

"Doug Robbins - Word MVP" wrote:

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

--
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

"JWS315" wrote in message
...
Changed as you suggested and used the following:
myTable.Rows(1).AllowBreakAcrossPage = False

Still get a 438 error code on the statement above...

Jerry

"Doug Robbins - Word MVP" wrote:

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.


--
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

"JWS315" wrote in message
...
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


"Doug Robbins - Word MVP" wrote:

Can you post the full code from your Access procedure so that I can
try
the
same thing from Access.

--
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

"JWS315" wrote in message
...
I am running the code from an Access module, the first thing I do is
add
the
table then I try to set the property. I am able to do other things
to
the
table via Access however run into a problem when trying to set this
property.
The table is a 2 row, 1 column table, nothing real elaborate.

Thanks for your help - Jerry

"Doug Robbins - Word MVP" wrote:

Running a macro with the following code from Word itself, certainly
sets
that attribute for the first row in the last table in the active
document:

Dim i As Long
i = ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Rows(1).AllowBreakAcrossP ages = False

From where are you running this code? Is the table being added to
the
document in the first place?

--
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

"JWS315" wrote in message
...
Doug,

The first format of the code I was using is basically the same (I
just
replaced i with the assignment) - i still get the same error - Is
this
something that cannot be done on a table object? I found in the
help
that
AllowBreakAcrossPages applies to a Tablestyle object so maybe I
am
taking
the
wrong approach?

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

Turns out you cannot use the .Count property as I suggested.
The
following
should work however

Dim i As Long
i = wdApp.ActiveDocument.Tables.Count
wdApp.ActiveDocument.Tables(i).Rows(1).AllowBreakA crossPages =
False


--
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

"JWS315" wrote in message
...
Doug,

I tried your suggestion, however I still receive the same
error.
In
looking
at Word VBA help it states that the AllowBreakAcrossPage
property
applies
to
a TableStyle object, if this is the case then I would guess
that
I
have
the
wrong statement.

Any suggestions on how the code would look would be
appreciated,
I
have
tried several interations but with no luck.

Thanks
Jerry

"Doug Robbins - Word MVP" wrote:

I would think that this line

wdApp.ActiveDocument.Tables(wdApp.ActiveDocument.T ables.Count).Rows

should be

wdApp.ActiveDocument.Tables.Count.Rows etc.



--
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

"JWS315" wrote in message
...

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:51 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"