Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open and paste Excel image in Word doc?

2 views
Skip to first unread message

Mark

unread,
Jan 29, 2003, 11:22:09 PM1/29/03
to
I figured out how to open a new Word doc from Excel, now
I'd like to programically paste an Excel camera copy image
into the doc?

I used this solution to open Word-

Sub OpenWord()
MyAppId = Shell("WINWORD.EXE
C:\temp\WordExample\file1.doc", _
vbMaximizedFocus)
End Sub

Is there a way to automatically paste the copied Excel
camera pic into the Word doc?

thanks!

Thanks!

Salonee Sawant

unread,
Jan 30, 2003, 12:59:32 AM1/30/03
to
hi Mark,

This not a proper way to open a word application because
u do not get an handle to the objects.

I have written the code for opening a new Word Document
and pasting the Excel data into it.

Before running the code, goto Tools>>References in your
VBA Editor of MS Excel and add a reference to 'Microsoft
Word Object Library'

the code --->

Sub PasteAsPic()
Dim WrdApp As New Word.Application
Dim wrdDoc As New Word.Document

'copy the required data from the Excel File
ThisWorkbook.Sheets(1).Range("B2:D10").Copy

' Create a new Word Document
Set wrdDoc = WrdApp.Documents.Add
(DocumentType:=wdNewBlankDocument)
WrdApp.Visible = True

'Paste the copied data as Picture
WrdApp.Selection.PasteSpecial Placement:=wdInLine,
DataType:=wdPasteBitmap

'save the new Word Document
wrdDoc.SaveAs "c:\Filename.doc", wdWord

'clean up code
wrdDoc.Close
Set wrdDoc = Nothing
Set WrdApp = Nothing

End Sub


HTH,

Regards,
Salonee Sawant
Business Productivity Analyst
Maestros Mediline Systems Ltd.
India.
in...@maestros.net

>.
>

Mark

unread,
Jan 30, 2003, 7:32:17 AM1/30/03
to
Thank you very much, I will try this today.

I want to distribute this spreadsheet once it is finished
to our sales team. Is there a way to programically
perform the 'Microsoft Word Object Library' References for
the user?

thanks again

Original Message-----

>.
>

0 new messages