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()
' Get Running Microsoft Word
Set wordApp = GetObject(, "Word.Application")
' Get Running Microsoft Visio
Set visioApp = GetObject(, "Visio.Application")
If wordApp = Nothing Then
Debug.Print "No Microsoft Word open"
Return
End If
' Copy selected object in Visio
visioApp.ActiveWindow.Selection.Copy
' Paste object in Word
wordApp.Selection.PasteSpecial Link:=False,
DataType:=wdPasteEnhancedMetafile, _
Placement:=wdFloatOverText, DisplayAsIcon:=False
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()
' Get Running Microsoft Word
Set wordApp = GetObject(, "Word.Application")
' Get Running Microsoft Visio
Set visioApp = GetObject(, "Visio.Application")
If wordApp = Nothing Then
Debug.Print "No Microsoft Word open"
Return
End If
' Copy selected object in Visio
visioApp.ActiveWindow.Selection.Copy
' Paste object in Word
wordApp.Selection.PasteSpecial Link:=False,
DataType:=wdPasteEnhancedMetafile, _
Placement:=wdFloatOverText, DisplayAsIcon:=False