DEWunderlich
05-17-2008, 09:44 PM
I am going through a Word document and selecting each page so I can copy and paste into a PowerPoint presentation. I am using ActiveDocument.ActiveWindow.Panes(1).Pages.Count to determine how many pages I have. I set up a loop like this to go through the document:
for i = 1 to ActiveDocument.ActiveWindow.Panes(1).Pages.Count
Set myRange = myRange.GoTo(What:=wdGoToPage, Name:=i)
....
For some reason, it says the pages.count value for my test document is 40, but when I step through it, it gets to 40 with 2 or 3 pages left, so the last pages don't get copied. If I set i higher than 40 in the immediate window while debugging, it finds the remaining sections. Does anyone know why this would be happening or what I can do to resolve it?
for i = 1 to ActiveDocument.ActiveWindow.Panes(1).Pages.Count
Set myRange = myRange.GoTo(What:=wdGoToPage, Name:=i)
....
For some reason, it says the pages.count value for my test document is 40, but when I step through it, it gets to 40 with 2 or 3 pages left, so the last pages don't get copied. If I set i higher than 40 in the immediate window while debugging, it finds the remaining sections. Does anyone know why this would be happening or what I can do to resolve it?