Reputation:
hIcon = Sheet1.Image1.Picture.Handle
I have sheet1 with image control with the name image1 but still getting this issue? Please help me with this. where I am doing wrong?
Upvotes: 1
Views: 559
Reputation: 43595
Compile Error: Variable not defined
means that the variable hIcon
is not defined.
Write Dim hIcon as Variant
on the line above the error, to define it.
As it is compiling error, every time before running the code, make sure to go to the VBEditor menu and press Debug>Compile VBA Project to see whether other errors like this exist:
Upvotes: 1