Hello,
I have an issue with a code that actually comes from the internet thatI want to use for my project.he projectI'm working on is a employee database with an image box on the right side. The code below is working when I'm running it at home however, when I finished it and about to present it to my boss and run the vba in my boss PC it's suddenly give me an error say: Compile error: Sub undefined whenever run on a different PC. Seems that both PC has the same references so I really need help on this. TIA.
This is the code that having the issue:
Public Sub prClipboardData2Image()
Dim hCopy&: OpenClipboard 0&
hCopy = CopyImage(GetClipboardData(2), 0, 0, 0, &H4)
CloseClipboard
If hCopy = 0 Then Exit Sub
Const IPictureIID = "{7BF80981-BF32-101A-8BBB-00AA00300CAB}"
Dim iPic As IPicture, tIID As GUID, tPICTDEST As PICTDESC, Ret&
Ret = IIDFromString(StrConv(IPictureIID, vbUnicode), tIID)
If Ret Then Exit Sub
With tPICTDEST
.cbSize = Len(tPICTDEST)
.picType = 1
.hImage = hCopy
End With
Ret = OleCreatePictureIndirect(tPICTDEST, tIID, 1, iPic)
If Ret Then Exit Sub
frmEmpDetails.imgEmp.Picture = LoadPicture("")
frmEmpDetails.imgEmp.Picture = iPic
Set iPic = Nothing
End Sub
Bookmarks