View Single Post
  #2  
Old 30-06-2006, 16:30
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Mouse Position

Sure you can get the mouse Position of were a user clicks. This will keep looping until l you press "ESC". Also the messagebox lets you know if the shift, control or Alt key was depressed when clicked.

Code:
Sub MousePosition()

Dim x As Double, y As Double
Dim Shift As Long
Dim b As Boolean
Dim txtKey As String

b = False
txtKey = "No Key"

While Not b
    b = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorEyeDrop)
        If Not b Then
            If (Shift And 1) <> 0 Then txtKey = "Shift" ' Shift depressed
            If (Shift And 2) <> 0 Then txtKey = "Ctrl" ' Ctrl depressed
            If (Shift And 4) <> 0 Then txtKey = "Alt" ' Alt depressed
            
            MsgBox "x: " & x & " y: " & y & Chr(13) & txtKey & " was depressed"
        End If
Wend
End Sub
Hope it helps,

Shelby
Reply With Quote