Hello.
I have the following in a module
And in the userform there is Image1 and i dont know how to In a MouseOver event call SetHandCursor()Code:Public Const WINAPI_HandCursor = 32649& Public Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long Public Declare Function GetCursor Lib "user32" () As Long Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long ' Remember the handle for the Hand cursor Public HandCursor As Long Public Sub SetHandCursor() On Error Resume Next ' Load the cursor only once If HandCursor = 0 Then HandCursor = LoadCursor(0, WINAPI_HandCursor) ' Only update the cursor if it isn't our current cursor ElseIf GetCursor() = HandCursor Then Exit Sub End If ' Finally, set the cursor to the Hand SetCursor HandCursor End Sub
Hello D_Rennie,
You don't need to use the API for this. The Image Control has 2 properties MouseIcon and MousePointer. Set the MouseIcon property to the cursor or icon file you want to use, and the MousePointer property to fmMousePointerCustom (99).
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Thankyou Leith Ross I stumbled with that though didnt see the connection with the mouse icon.
I had success loading 8bit .ico files are these the only types to use. you wouldnt know of a good site to get them would you.
if i set it like this, and then you ran the userform would you get a error cos it looks for the file ??
A lot easer thankyou.
Now available : Ultimate Add-In 2007
Integrates directly into the Office Excel Ribbon
Download Ultimate Add-In v1.52 from www.dom-and-lis.co.uk
90+ Utilities, 200+ Sub utilities last updated 25th April 2008
Free!!
Now available : Ultimate Add-In 2007
Integrates directly into the Office Excel Ribbon
Download Ultimate Add-In v1.52 from www.dom-and-lis.co.uk
90+ Utilities, 200+ Sub utilities last updated 25th April 2008
Free!!
Hello D_Rennie,
You can load the icon or cursor file from a file or you can insert the icon or cursor using the Property Page in the Visual Basic Editor. This will save it as resource file in your VBA project. I have included the "hand" cursor file for you.
While in the Visual Basic Editor
1. Display the UserForm
2. Click on the Image Control
3. Press F4 to display the Properties Page
4. Click to the cell to the right of MouseIcon to browse for the file
5. Select the file and click Open
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
dominicb. Just playing with the icons. though thankyou ill keep that for the future.
Leith Ross. cheers for putting up the file.
Thankyou both very much.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks