Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Variable not defined. 1

Status
Not open for further replies.

Hanss

Technical User
Feb 15, 2001
85
CH
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
 
for one the clipboard object is not availble in access
 
Thank you both for clearing this up for me. I am slowly learning that not everything that works in VB also works in VBA...

- Hanss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top