I am trying to use the following code on access xp (SP3) and I get the complile error "variable not defined" at:
Clipboard.GetData(vbCFBitmap)
I would appreciate any help as to why this is happening. Do I need to upgrade my VBA?
Many Thanks!
Kind regards,
Hanss
Zurich, Switzerland
My code:
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Function SaveFormPic() As Picture
Clipboard.Clear
Dim pic As StdPicture
Set pic = Clipboard.GetData(vbCFBitmap)
keybd_event vbKeyMenu, 0, 0, 0
keybd_event vbKeySnapshot, 0, 0, 0
DoEvents
keybd_event vbKeySnapshot, 0, KEYEVENTF_KEYUP, 0
keybd_event vbKeyMenu, 0, KEYEVENTF_KEYUP, 0
DoEvents
Set SaveFormPic = Clipboard.GetData(vbCFBitmap)
Clipboard.SetData pic, vbCFBitmap
End Function
Private Sub Command1_Click()
SavePicture SaveFormPic, "C:\MyPic.jpg" 'picture location
End Sub
Clipboard.GetData(vbCFBitmap)
I would appreciate any help as to why this is happening. Do I need to upgrade my VBA?
Many Thanks!
Kind regards,
Hanss
Zurich, Switzerland
My code:
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Function SaveFormPic() As Picture
Clipboard.Clear
Dim pic As StdPicture
Set pic = Clipboard.GetData(vbCFBitmap)
keybd_event vbKeyMenu, 0, 0, 0
keybd_event vbKeySnapshot, 0, 0, 0
DoEvents
keybd_event vbKeySnapshot, 0, KEYEVENTF_KEYUP, 0
keybd_event vbKeyMenu, 0, KEYEVENTF_KEYUP, 0
DoEvents
Set SaveFormPic = Clipboard.GetData(vbCFBitmap)
Clipboard.SetData pic, vbCFBitmap
End Function
Private Sub Command1_Click()
SavePicture SaveFormPic, "C:\MyPic.jpg" 'picture location
End Sub