![]() |
#1
|
|||
|
|||
![]()
I am trying to write a macro to search through a large text file to find page numbers. These numbers are on their own lines with no other text. I want to check that all the line numbers are there and in the correct order. I want to start at the top of the first page and then search for the first number. Then search down from the first number to find the next, and so on. I have started with the following macro.
'Goto the top of page 1 Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="1" For n = 1 To 100 t = "^p" & n & "^p" With Selection.Find .ClearFormatting .Text = t .Forward = True .Wrap = wdFindStop End With If Selection.Find.Execute = False Then Stop Next n This will only find the first line number. If I change the .Wrap line to wdFindContinue it will go back and search the whole document, not just from where the previous search stopped. So this will not show if the page numbers are out of sequence. If anyone can point me in the right direction it would be greatly appreciated. I am using Word 2003 and Windows 7. |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA to Find and Format Text string defined using Inputbox within selection | sistemalan | Word VBA | 7 | 10-03-2014 07:28 AM |
![]() |
Hoxton118 | Word VBA | 7 | 06-10-2014 05:05 AM |
![]() |
ramsgarla | Word VBA | 9 | 12-05-2012 03:23 AM |
Help! Find text in doc file & copy to another file | northstarman | Word | 1 | 11-05-2010 08:15 AM |
Automatic find replace after selection in dropdown | vsempoux | Word | 0 | 10-28-2009 08:45 AM |