Add content on same doc.

B

Bala

Hi all,

one of my word doc contain 20 pages. For example, I want to paste the pages
2,5,10 to another document thru vb program. the page nos will vary depends on
users choice. so i using below code. the tmptotal contain no of total pages.
i dont know how to add each pages into same document. currently i can able to
add a seperate a document. the below code i am using currently. anyone give
me idea to solve this.

thanks
bala

code:

For i = 1 To tmptotal
If i = 1 Or i = 4 Or i = 6 Then
objWord.ActiveDocument.Bookmarks("\page").Range.Copy
objwordtarget.Documents.Add.Content.Paste
objwordtarget.Visible = True
End If
objWord.Application.Browser.Next
Next
 
B

Bala

No Problem. got it. here is the code

For i = 1 To tmptotal
If i = 1 Or i = 4 Or i = 6 Then
objWord.ActiveDocument.Bookmarks("\page").Range.Copy
If i = 1 Then
With objwordtarget
.Documents.Add
End With
End If
With objwordtarget

.Selection.Paste
End With
objwordtarget.Visible = True
End If
objWord.Application.Browser.Next
Next

thanks
bala
 

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