M
Mike
Hi! I need to port the following code snippet from vba-programmer.com to
cycle through document pages:
http://www.vba-programmer.com/Code_Word/Cycling_through_Document_Pages.txt
MaxPages = Selection.Information(wdNumberOfPagesInDocument)
For i = 1 To MaxPages
Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Count:=i, Name:=""
ActiveDocument.Bookmarks("\page").Select
Next
Here's my code in C#:
object objWHAT =Word.WdGoToItem.wdGoToPage;
object objWHICH = Word.WdGoToDirection.wdGoToFirst;
object objCOUNT = null;
object NAME = "";
sel = doc.Application.Selection;
int MaxPages =(int)
sel.get_Information(Word.WdInformation.wdNumberOfPagesInDocument);
for (int i = 1; i <= MaxPages; i++)
{
objCOUNT = i;
sel.GoTo(ref objWHAT, ref objWHICH, ref objCOUNT, ref NAME);
// !!!!!!!!!!! How do I port this line ???????
ActiveDocument.Bookmarks("\page").Select
}
}
Thank you in advance,
cycle through document pages:
http://www.vba-programmer.com/Code_Word/Cycling_through_Document_Pages.txt
MaxPages = Selection.Information(wdNumberOfPagesInDocument)
For i = 1 To MaxPages
Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Count:=i, Name:=""
ActiveDocument.Bookmarks("\page").Select
Next
Here's my code in C#:
object objWHAT =Word.WdGoToItem.wdGoToPage;
object objWHICH = Word.WdGoToDirection.wdGoToFirst;
object objCOUNT = null;
object NAME = "";
sel = doc.Application.Selection;
int MaxPages =(int)
sel.get_Information(Word.WdInformation.wdNumberOfPagesInDocument);
for (int i = 1; i <= MaxPages; i++)
{
objCOUNT = i;
sel.GoTo(ref objWHAT, ref objWHICH, ref objCOUNT, ref NAME);
// !!!!!!!!!!! How do I port this line ???????
ActiveDocument.Bookmarks("\page").Select
}
}
Thank you in advance,