H
Hema Neelagiri
i have 3 pages template
in 2nd page from macro i am inserting file doc2 where bookmarks are there
for i=0 to 2
Selection.GoTo What:=wdGoToSection, Which:=wdGoToLast
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.InsertFile Filename:=mstrTemplatePath,
Range:="mtaLoop", ConfirmConversions:=False, Link:=False, Attachment:=False
For Each frmfld In ActiveDocument.FormFields
Select Case frmfld.Name
Case "mta070" 'ID
frmfld.Select
Selection.TypeText "aa" & i
End Select
Next frmfld
next
with above code 3 new pages are coming properly(total 5 pages 3 new+ first
page and 3rd page of template), but absed on data these file may have
differnt pages,
i need to know on which page (page number) the new selection starts
when i am trying to finding the pagenumber with below code
MsgBox "The selection is on page " & _
Selection.Information(wdActiveEndPageNumber) & " of page " _
& Selection.Information(wdNumberOfPagesInDocument)
the very first time(when i=0) the page number is giving 1 of 3, and next 4
of 4, 5 of 5
but i need these 2 of 3, 3 of 4, 4 of 5
means when we are inserting files those pages are appending in the last, not
after 2 nd page
can u please help me
in 2nd page from macro i am inserting file doc2 where bookmarks are there
for i=0 to 2
Selection.GoTo What:=wdGoToSection, Which:=wdGoToLast
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.InsertFile Filename:=mstrTemplatePath,
Range:="mtaLoop", ConfirmConversions:=False, Link:=False, Attachment:=False
For Each frmfld In ActiveDocument.FormFields
Select Case frmfld.Name
Case "mta070" 'ID
frmfld.Select
Selection.TypeText "aa" & i
End Select
Next frmfld
next
with above code 3 new pages are coming properly(total 5 pages 3 new+ first
page and 3rd page of template), but absed on data these file may have
differnt pages,
i need to know on which page (page number) the new selection starts
when i am trying to finding the pagenumber with below code
MsgBox "The selection is on page " & _
Selection.Information(wdActiveEndPageNumber) & " of page " _
& Selection.Information(wdNumberOfPagesInDocument)
the very first time(when i=0) the page number is giving 1 of 3, and next 4
of 4, 5 of 5
but i need these 2 of 3, 3 of 4, 4 of 5
means when we are inserting files those pages are appending in the last, not
after 2 nd page
can u please help me