Subject oriented commands can be given to any of the Office suit application using VBA which is aligns instructions for customize operations and repetitive tasks while using Office tools. Those who have consistent working with Excel or Word or any other, they can add customize features, buttons and automated task program to make their task shorter and convenient then regular working mode. VBA can help you adding something new which might not be the part of regular version.
Tips to Click Mouse in VBA:
Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Public Const MOUSEEVENTF_LEFTDOWN = &H2 Public Const MOUSEEVENTF_LEFTUP = &H4 Public Const MOUSEEVENTF_RIGHTDOWN As Long = &H8 Public Const MOUSEEVENTF_RIGHTUP As Long = &H10 Private Sub SingleClick() SetCursorPos 100, 100 'x and y position mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 End Sub Private Sub DoubleClick() 'Double click as a quick series of two clicks SetCursorPos 100, 100 'x and y position mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 End Sub Private Sub RightClick() 'Right click SetCursorPos 200, 200 'x and y position mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0 mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 End Sub
For this similar reason, moving mouse and clicking on the notes is another thing you can do using VBA. There are specially designed codes and programming instructions in VBA, a language designed by Microsoft for the integration of personalized features. Using the coded instructions, you can move the mouse cursor and click on anything by using this language.
Using Macro window in Excel, you need to write or copy/paste the code while directs the cursor to move in the mentioned direction along its axis. Once you are done with applying the code, you can practically and easily control the mouse movement using VBA projections. By providing the number of pixel from the top left corner and number of pixel from bottom right corner, you can control the axial orientation of cursor. This can be even convenient if you do the entire task by directly pasting the readily available codes for all the movements and cursor pointing and clicking the objects.