Shrout1
08-03-2011, 11:17 AM
I would like to be able to place a textbox in a powerpoint presentation directly below the cursor. This will be triggered by pressing enter while a command button is selected.
Here is the code I am utilizing to get the X & Y position of my cursor:
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
Dim pos As POINTAPI ' Declare variable
Private Sub cmdGetLoc_Click()
GetCursorPos pos ' Get Co-ordinates
MsgBox "Cursor Pointer is at:" & vbNewLine _
& "x:=" & pos.x & vbNewLine _
& "y:=" & pos.y
End Sub
The following thread from 2008 seems to touch on what I am trying to do, but doesn't fully explore the solution.
http://tek-tips.com/viewthread.cfm?qid=1459089&page=2
I need some way to either:
1)Translate the X,Y coordinates from my monitor (with its 1440x900 resolution) into left/top coordinates or
2)Detect that the cursor is on the presentation and drop a textbox directly onto my X,Y coords without using left/top at all.
The first solution isn't ideal either as someone else using a different resolution screen will not always have the same positioning of windows, etc. Furthermore, I may not have Powerpoint maximized etc.
Any thoughts would be greatly appreciated!
Here is the code I am utilizing to get the X & Y position of my cursor:
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
Dim pos As POINTAPI ' Declare variable
Private Sub cmdGetLoc_Click()
GetCursorPos pos ' Get Co-ordinates
MsgBox "Cursor Pointer is at:" & vbNewLine _
& "x:=" & pos.x & vbNewLine _
& "y:=" & pos.y
End Sub
The following thread from 2008 seems to touch on what I am trying to do, but doesn't fully explore the solution.
http://tek-tips.com/viewthread.cfm?qid=1459089&page=2
I need some way to either:
1)Translate the X,Y coordinates from my monitor (with its 1440x900 resolution) into left/top coordinates or
2)Detect that the cursor is on the presentation and drop a textbox directly onto my X,Y coords without using left/top at all.
The first solution isn't ideal either as someone else using a different resolution screen will not always have the same positioning of windows, etc. Furthermore, I may not have Powerpoint maximized etc.
Any thoughts would be greatly appreciated!