SeniorNewbie
Board Regular
- Joined
- Jul 9, 2023
- Messages
- 77
- Office Version
- 2021
- 2019
- Platform
- Windows
- MacOS
sorry cursor ...
Hi out there,
the following code (provided my MS) makes is easy (e.g. by double click event) to get the coordinates of a cursor in a worksheet:
But what I need is this information on top of an image. As example: the image is map and I want to get more information about a region clicking on it. The're about 65 spots I need and I want o avoid to play around with shapes.
Any ideas about a solution?
Many THX!
Senior Newbie
Hi out there,
the following code (provided my MS) makes is easy (e.g. by double click event) to get the coordinates of a cursor in a worksheet:
VBA Code:
Option Explicit
Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
' Access the GetCursorPos function in user32.dll
Declare Function SetCursorPos Lib "user32" _
(ByVal x As Long, ByVal y As Long) As Long
' GetCursorPos requires a variable declared as a custom data type
' that will hold two integers, one for x value and one for y value
Type POINTAPI
X_Pos As Long
Y_Pos As Long
End Type
' Main routine to dimension variables, retrieve cursor position,
' and display coordinates
Sub Get_Cursor_Pos()
' Dimension the variable that will hold the x and y cursor positions
Dim Hold As POINTAPI
' Place the cursor positions in variable Hold
GetCursorPos Hold
' Display the cursor position coordinates
MsgBox "X Position is : " & Hold.X_Pos & Chr(10) & _
"Y Position is : " & Hold.Y_Pos
End Sub
But what I need is this information on top of an image. As example: the image is map and I want to get more information about a region clicking on it. The're about 65 spots I need and I want o avoid to play around with shapes.
Any ideas about a solution?
Many THX!
Senior Newbie
Last edited: