Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy & Paste Problem

Status
Not open for further replies.

BIGDOG1013

Technical User
Jun 20, 2003
2
US
Im Having 2 problems.
1) How do u open the existing document without wiping out previous changes(like the bookmarks I added). The following code seems to create a new word doc instead of using the existing document embedded.

2) How would I Paste spreadsheet range onto Page2? Bookmarks?

The following code is what I have come up with so far:

Excel.ActiveWorkbook.Worksheets(1).Shapes("OBJECT 1").Select
Selection.Verb Verb:=xlPrimary
Excel.Range("Range").Copy
Word.Documents(1).Select
Word.ActiveDocument.Bookmarks(1).Select
Word.Selection.PasteSpecial

Excel.ActiveWorkbook.Worksheets(1).Shapes(1).OLEFormat.Activate
instead of the first two lines of code

 
Q1: Use document templates.

Q2: Yes a bookmark could be your solution.

Herman
 
Hi BIGDOG1013,

I don't really understand what you mean by open the existing document without wiping out previous changes(like the bookmarks I added). But, bookmarks can be deleted by the code you show, depending on how they are set up.

If a bookmark is created with the selection collapsed (i.e. at an insertion point) then all works as I think you want. If a bookmark is created without collapsing the selection (in other words you select some text and then insert a bookmark) then when the bookmark is selected, the text is also selected and when you paste over it, the text is deleted along with the bookmark.

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top