how to get Continuous page numbers while inserting file from one doc to another

  • Thread starter hemaneelagiri via OfficeKB.com
  • Start date
H

hemaneelagiri via OfficeKB.com

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
 
D

Doug Robbins - Word MVP

Once again, another gobbledegook question. Please think about what it is
that you want to do and post a meaningful question.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top