Novice stuck with simple bug

D

Dave Neve

Hi

Yet again, I must explain that I am a novice with VB.

I'm using a book on VB.Net although I'm using VBA (Word) to get to
understand VB

The following code was partly generated by VBA and I added the line
'Debug.............'

Problem is it doesn't work and I'm not up to it to understand why.

The code should display a form and the coordinates of the mouse should
appear on the screen when over the form (fat chance)

Can anyone help?

Thanks



Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Debug.Write (e.X & "," & e.Y & ",")
End Sub
 
H

Helmut Weber

Hi Dave,
at least in Word 97 there seems to be no method "write"
of "debug". Use "debug.print" instead.
Besides that, I don't see what "e.X" and "e.Y" are.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, W98
 
D

Dave Neve

Hi

According to the book

e : stocks the parametre value

X and Y: the distance from the left and top margins in pixels.

Does this help you to explain why it doesn't work?

Thanks
 
H

Helmut Weber

Hi Dave,
at least, in Word 97 the following code works:
Private Sub UserForm_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, _
ByVal Y As Single)
' Debug.write (e.X & "," & e.Y & ",")
Debug.Print (X & "," & Y & ",")
End Sub
But, of course, quite a lot of data are produced
by that. I wouldn't test it for too long.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, W98
 
D

Dave Neve

Hi

I can't get it to work but I'm gonna put it down to a lack of experience.

Thanks anyway.
 
R

RWN

Not an expert but, are you looking in the right place?
The "Debug.Print" will generate the output to the "Immediate Window" in
the VB Editor - not the sheet/form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top