![]() |
#9
|
|||
|
|||
![]()
I get the following error on this line...
ScnBrk = .Sections(i).PageSetup.SectionStart Run-time error '5941' The requested member of the collection does not exist Code:
Sub GetAndRemoveSectionByInstanceNumber() Dim strSearchString As String Dim ScnBrk As Long Dim i As Long ' start at top of document Selection.HomeKey Unit:=wdStory System.Cursor = wdCursorWait strSearchString = "Inst#: " & ReportInstance With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = strSearchString .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With If .Find.Found = True Then ' .Find.Found = True Then i = .Duplicate.Sections(1).index - 1 ScnBrk = .Sections(i).PageSetup.SectionStart 'error here .Duplicate.Sections(1).Range.Delete .Sections(i).PageSetup.SectionStart = ScnBrk End If End With End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
New Daddy | Word | 6 | 02-03-2014 07:09 PM |
![]() |
Carlabasson | Word | 2 | 03-25-2013 10:13 PM |
Continuous section break and column changes | Jim B | Word | 3 | 11-27-2012 02:25 PM |
why the "section break-next page" is switched to "section break-continuous"? | Jamal NUMAN | Word | 6 | 12-14-2011 03:35 PM |
![]() |
Jamal NUMAN | Word | 2 | 06-22-2011 04:46 PM |