Copy-paste scripting bug?

S

snaapy

Hi,

I am trying to copy an object from Visio and paste it to Word using
Visual Basic scripting. I want the copied object to be pasted as an
enhanched metafile. No matter what I use as a destination data type,
the object ends up be pasted as an embedded Visio object.

Manual pasting works fine.

Is there a workaround for this?

My code:


Sub DoCopyPaste()
' sadfsdf
' sdfsfsfs

' Get Running Microsoft Word
Set wordApp = GetObject(, "Word.Application")

' Get Running Microsoft Visio
Set visioApp = GetObject(, "Visio.Application")

If wordApp = Ntoning Then
Debug.Print "No Microsoft Word open"
Return
End If

Debug.Print "Dealing with MS Word:" + wordApp

' Copy selected object in Visio
visioApp.ActiveWindow.Selection.Copy

' Paste object in Word
wordApp.Selection.PasteSpecial Link:=False,
DataType:=wdPasteEnhancedMetafile, _
Placement:=wdFloatOverText, DisplayAsIcon:=False
 

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