-
private 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)
private mtimecount as integerprivate sub form_load()mtimecount = 0
1000 'Set the 1-second clock.
end sub
private sub timer1_timer()dim v_x as long
dim v_y as long
if mtimecount = 0 thenv_x = 0 'Set the x-coordinate.
v_y = 50 'Set the Y coordinates.
mtimecount = mtimecount + 1elsev_x = 0 'Set the x-coordinate.
v_y = -50 'Set the Y coordinates.
mtimecount = 0
end if
call mouse_event(mouseeventf_move, v_x, v_y, 0&, 0&)
end sub
I feel like this feature is a bit boring, but it's fun, hehe.
-
1. First of all, open the VBA in the development tools.
2. Enter some of the content you want in the cell area.
3. Insert the module into the VBA.
4. Enter ** in the module and run.
5. Use the shortcut key alt+f8 to bring up the running macro window, and then click the "execute" button, and the mouse has been limited to move within the scope of the ribbon.
-
private 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)
Specifies that the mouse uses an absolute coordinate system, and the screen is evenly divided into 65535 65535 cells in both horizontal and vertical directions.
Move the mouse. Simulates a left mouse button press.
Simulates the left mouse button lifted.
private const sw = 1024
private const sh = 768
private sub screen_click(byval x as long, byval y as long)
mw = x / sw * 65535
mh = y / sh * 65535
Mouse Event MouseEventf Absolute or MouseEventf Move, MW, MH, 0, 0
Click Mouse Event MouseEventf Leftdown or MouseEventf LeftUp, 0, 0, 0, 0
end sub
sub test()
screen_click 512, 384
end sub
tooltiptext property.
Go back or set a tooltip. >>>More
VBA looks for duplicate bai values in general
Use dictionary objects for examples. >>>More
Microsoft has taken into account the above reasons, you can take the program you compiled with VB, make it into an EXE application, do not directly save it in VB format!! If you make that exe it can run on all Windows computers, even if you don't have VB software installed! It can also be run, if you want to view or modify the source of the program**, then your VB source file, don't, delete, you can change it, and then make it into an exe and bring it to the company to demonstrate!! >>>More
If you want to learn systematically, you can consider signing up for a live online class, and recommend CGWANG's online class. The teacher speaks carefully, you can watch it back after the class, and there are also the same type of recorded classes that you can learn for free (give away lifelong VIP). >>>More
First, select the widget you want to generate the mouse movement event. >>>More