Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |