mouse click and hold, then change cursor while holding

bandz

New Member
Joined
Mar 31, 2017
Messages
2
i am trying to write a code that opens a scrn shot Programme to take scrn shots using VBA,
so the Problem is with the mouse function that i would like the function to click then hold the click and to Change the Position(X,Y) of the Cursor to take the scrn shot as i want it to.
ScreenshotReaderID = Shell("C:\Program Files (x86)\ABBYY Screenshot Reader 11\ScreenshotReader.exe", vbNormalFocus)
' AppActivate (ScreenshotReaderID)
here is my code that im trying out
i know the code is wrong but thats what i could gather after reading and checking many forums

Application.Wait (Now() + TimeValue("00:00:3"))
Beep
SendKeys "%{TAB}", True
Beep
Application.Wait (Now() + TimeValue("00:00:1"))
Beep
'SendKeys "%~", True
Application.Wait (Now() + TimeValue("00:00:1"))

Call GetCursorPos(Pt)
aX = Pt.X
aY = Pt.Y
If aY > 100 Then aY = aY - 15
If aX > 100 Then aX = aX - 20


aY = 130
aX = 1120

Call SetCursorPos(aX, aY)

'MsgBox ("1")

'Stop


mouse_event MOUSEEVENTF_LEFTDOWN, 500, 500, 0, 0

'Call SetCursorPos(aX + 100, aY + 100)

mouse_event MOUSEEVENTF_LEFTUP, 600, 600, 0, 0


MsgBox ("dfg")

mouse_event MOUSEEVENTF_LEFTDOWN, 500, 500, 0, 0

'Call SetCursorPos(aX + 100, aY + 100)

mouse_event MOUSEEVENTF_LEFTUP, 600, 600, 0, 0


mouse_event MOUSEEVENTF_LEFTDOWN, 500, 500, 0, 0

Call SetCursorPos(aX + 100, aY + 100)

mouse_event MOUSEEVENTF_LEFTUP, 600, 600, 0, 0

MsgBox ("2dfg")

GoTo nochmal


End Sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,977
Messages
6,175,753
Members
452,667
Latest member
vanessavalentino83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top