Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
Private Type GUID
    Data1 As Long
    Data2 As Integer
    Data3 As Integer
    Data4(7) As Byte
End TypePrivate Type PicBmp
    Size As Long
    Type As Long
    hBmp As Long
    hPal As Long
    Reserved As Long
End Type
Private Function CreateBitmapPicture(ByVal hBmp As Long, ByVal hPal As Long, ByVal iType As Integer) As Picture    Dim R As Long, Pic As PicBmp, IPic As IPicture, IID_IDispatch As GUID    'Fill GUID info
    With IID_IDispatch
        .Data1 = &H20400
        .Data4(0) = &HC0
        .Data4(7) = &H46
    End With    'Fill picture info
    With Pic
        .Size = Len(Pic) ' Length of structure
        .hBmp = hBmp ' Handle to bitmap
        .hPal = hPal ' Handle to palette (may be null)
        
        If iType = 0 Then
            .Type = vbPicTypeBitmap ' Type of Picture (bitmap)
        Else
            .Type = vbPicTypeIcon
        End If
    End With    'Create the picture
    R = OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)    'Return the new picture
    Set CreateBitmapPicture = IPic
    
End Function