S
Steve
I need to paste (using VBA) pictures into a 2-cell table in a Word document.
Sometimes the pictures are photos copied from the web and they have to be
pasted as Device Independent Bitmaps
(DataType:=wdPasteDeviceIndependentBitmap).
Sometimes they are grouped PowerPoint objects or pictures of Excel graphs
and are pasted in as plain Picture (DataType:=wdPasteMetafilePicture).
I'm using a poor hack (On Error Resume Next) to paste the picture with the
correct data format (see code below). What's the right way to check the data
type on the clipboard before pasting it in? I presume this requires an API
call.
Steve
With oCell1.Range ' top cell in the table
' How to figure out in advance which pic format to use?
On Error Resume Next
.PasteSpecial Link:=False, _
DataType:=wdPasteDeviceIndependentBitmap, _
Placement:=wdInLine, _
DisplayAsIcon:=False
.PasteSpecial Link:=False, _
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, _
DisplayAsIcon:=False
.ParagraphFormat.KeepWithNext = True
End With
Sometimes the pictures are photos copied from the web and they have to be
pasted as Device Independent Bitmaps
(DataType:=wdPasteDeviceIndependentBitmap).
Sometimes they are grouped PowerPoint objects or pictures of Excel graphs
and are pasted in as plain Picture (DataType:=wdPasteMetafilePicture).
I'm using a poor hack (On Error Resume Next) to paste the picture with the
correct data format (see code below). What's the right way to check the data
type on the clipboard before pasting it in? I presume this requires an API
call.
Steve
With oCell1.Range ' top cell in the table
' How to figure out in advance which pic format to use?
On Error Resume Next
.PasteSpecial Link:=False, _
DataType:=wdPasteDeviceIndependentBitmap, _
Placement:=wdInLine, _
DisplayAsIcon:=False
.PasteSpecial Link:=False, _
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, _
DisplayAsIcon:=False
.ParagraphFormat.KeepWithNext = True
End With