Ok I really need help with macro's in VB. I have no knowledge of them what so ever so I was wondering if any of you could either link me to a macro tutorial (I've been searching for about 13 days for one, I can't find anything) or tell me yourself.. Anything would be useful.

Thanks in advance, Tova

11 Years
Discussion Span
Last Post by Tovabi

What type of Macro are you trying to create? That will help us point you in the right Direction. Ar eyou sure this is not VBA?


Mouse Events are not macro's. Mouse events are actual events that occur within VB when spawned by a specific action. If you are looking on how to fire those events programatically, you can look into sendkeys, or the sendmessage API.


Tell us what you are trying to accomplish, it might make it easier to tell you wherer to go,or at least we could offer better help.


Yeah, Because I'm sure I can help you with any problem you have, but we need a little more information to go by.


Kk, well my final target is something for a game that would pick up some spears once you throw them (they would land beneath the target ingame when you're "training"). But untill i am able to do that im just making random things to get used to it, like yesturday i made a macro that you could spam on msn or any other program using the sendkeys function. Anyway basicly what i am trying to accomplish is how to controll the mouse at a click of a button, thanks again guys


The MouseMove and mousedown and click events are all part o fthe form yoyu are using using mouse move the x and y will give you it's co-ords and the button will give you which button was pressed or held.

try this blank form with two buttons and 1 label.

Option Explicit

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Top = Int(Rnd * Me.Height) + 1
 If Command1.Top + Command1.Height > Me.Height Then Command1.Top = Command1.Top - Command1.Height
Command1.Left = Int(Rnd * Me.Width) + 1
If Command1.Left + Command1.Width > Me.Width Then Command1.Left = Command1.Left - Command1.Width

End Sub

Private Sub Command2_Click()
MsgBox "I knew it"
End Sub

Private Sub Form_Load()
Command1.Caption = "Yes"
Command2.Caption = "No"
Label1.Caption = "I am Smart"
End Sub

Hmmmm i can understand it a little, but can you explain the X and Y thing a little clearer? And also how can i make it so it will i dunno like say go directly on the "Send" key of msn or something like that?


That will take learning handles. A whole other discussion.

I forgot about the X and the Y..

These are just the co-ords of the horizontal(X) and vertical(y) positions on your form.
top left is (0,0) (X,Y)
top right is (0,255)
bottom left (255,0)
bottom right (255,255)

if the height and width are 255...

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.