Pasting Range from Excel 2002 via VBA to Word causes a New Workbook to open 
Author Message
 Pasting Range from Excel 2002 via VBA to Word causes a New Workbook to open

Hi Sean,

Does it also happen when you copy/paste like this "by hand"?

Rather than use Copy/Paste, I'd insert a LINK field (the
result you get when you do copy/paste - press Alt+F9 to
toggle on the field codes and you'll see it) in Word. That
will be a bit faster and more reliable, generally, than the
Clipboard.

Quote:
> I have an excel file that uses Automation to paste ranges
> from an Excel workbook to a Word Document.  The code below
> works fine in '97 and 2000, but causes a new workbook
> (copy of the original) to be opened when excel executes
> WordApp.Selection.PasteSpecial...  Has anyone else seen
> this?

> '       Insert Graphic files from excel
>         Worksheets.Application.Range("ModelInfoArea").Copy
>         WordApp.ActiveDocument.Bookmarks
> ("ModelInfoArea").Select
>         WordApp.Selection.PasteSpecial Link:=False,
> DataType:=wdPasteMetafilePicture, _
>         Placement:=wdInLine, DisplayAsIcon:=False

Cindy Meister
INTER-Solutions, Switzerland
http://www.*-*-*.com/
http://www.*-*-*.com/
http://www.*-*-*.com/

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :-)



Fri, 22 Oct 2004 15:44:58 GMT  
 Pasting Range from Excel 2002 via VBA to Word causes a New Workbook to open
Hi Sean,

Does it also happen when you copy/paste like this "by hand"?

Rather than use Copy/Paste, I'd insert a LINK field (the
result you get when you do copy/paste - press Alt+F9 to
toggle on the field codes and you'll see it) in Word. That
will be a bit faster and more reliable, generally, than the
Clipboard.

Quote:
> I have an excel file that uses Automation to paste ranges
> from an Excel workbook to a Word Document.  The code below
> works fine in '97 and 2000, but causes a new workbook
> (copy of the original) to be opened when excel executes
> WordApp.Selection.PasteSpecial...  Has anyone else seen
> this?

> '       Insert Graphic files from excel
>         Worksheets.Application.Range("ModelInfoArea").Copy
>         WordApp.ActiveDocument.Bookmarks
> ("ModelInfoArea").Select
>         WordApp.Selection.PasteSpecial Link:=False,
> DataType:=wdPasteMetafilePicture, _
>         Placement:=wdInLine, DisplayAsIcon:=False

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :-)



Fri, 22 Oct 2004 15:47:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Populating a ListBox via a VBA macro when opening an Excel Workbook

2. Populating a ListBox via a VBA macro when opening an Excel Workbook

3. Using VBA to select a highlighted range and paste values to another workbook

4. VBA Excel 2002 trying to open a Word document

5. Printing Multipage Word 2002 document within an Excel 2002 Workbook

6. Excel 97 Crashes when opening via Workbooks.open

7. Open Word from Excel via VBA

8. Open Workbooks via vba code.

9. Excel 2002 Error: No more new fonts may be applied in this workbook

10. How do I paste a value from VBA in to a cell in excel workbook


 
Powered by phpBB® Forum Software © phpBB Group