tags:

views:

610

answers:

2

I am trying to copy an image from the clipboard to Microsoft Word using VBScript. How can I do this?

+4  A: 

Are you in a WSH environment? Or is this in VBA?

In VBA, you simply do Application.Selection.Paste.

In WSH:

Set wordapp = CreateObject("Word.Application")
wordapp.Visible = True
wordapp.Documents.Add
wordapp.Selection.Paste
codeape
A: 

I don't believe it is possible to direclty access the clipboard using vbscript. You can however very cleverly use vbscript to drive IE and use IE to do the grunt work for you. Have a look at this implementation

Conrad
It might not be possible from pure VBScript, but since the question is about Word, it can be done easily by pasting the object in Word (see the answer by codeape)
0xA3