Question export Excel range into bitmap

Keith Howard

Active member
Joined
Jan 28, 2010
Messages
28
Programming Experience
5-10
Private Sub msxxxSaveRangeAsImage(ByVal vvrgeSourceRange As Range, _
ByVal vvstrFilePathName As String)
Dim lvobhGUIDDispatchInterface As mvobhGUID
Dim lvobhImageProperties As mvobhImage
Dim lvobhIPicture As IPicture
Dim lvislClibboardData As Long
Const lcintClipboardBitmapImageType As Integer = 2
Const lcintBitmapImageType As Integer = 1
vvrgeSourceRange.CopyPicture(XlPictureAppearance.xlScreen, XlCopyPictureFormat.xlBitmap)
OpenClipboard(0)
lvislClibboardData = GetClipboardData(lcintClipboardBitmapImageType)
CloseClipboard()

With lvobhGUIDDispatchInterface
ReDim .gviudData4(8)
.gvislData1 = &H7BF80980
.gvintData2 = &HBF32
.gvintData3 = &H101A
.gviudData4(0) = &H8B
.gviudData4(1) = &HBB
.gviudData4(2) = &H0
.gviudData4(3) = &HAA
.gviudData4(4) = &H0
.gviudData4(5) = &H30
.gviudData4(6) = &HC
.gviudData4(7) = &HAB
End With
With lvobhImageProperties
.gvislSize = Len(lvobhImageProperties)
.gvislType = lcintBitmapImageType
.gvislHandleToImage = lvislClibboardData
.gvislHandleToPalette = 0
End With
'#[7:SainG00<HowRK00: Enliven the next 2 lines.]
OleCreatePictureIndirect(lvobhImageProperties, lvobhGUIDDispatchInterface, 1, lvobhIPicture)
stdole.Picture(lvobhIPicture, vvstrFilePathName) 'SavePicture(lvobhIPicture, vvstrFilePathName)

End Sub

I am exportin excel range into Bitmap.
I am getting error using stdole.SavePicture(lvobhIPicture, vvstrFilePathName)
If anyone can solve my issue that will be gr8. :) thank
 
Top Bottom