GrannyM said:
We are using Word 2003. In the VBA module on the Standard Toolbar, it gives
you the line and col number of where your cursor is at in your code. We
would like to be able to pull that line number into a variable.
As Tony said, unless you add numbers to each line, no can do.
To give you
a basic idea of what we want to do, we have hundreds of users and they expect
us to be omniscient and know everything without them giving us any
information.
"Doesn't work," right?
We've tried creating message boxes, but they tend to enter
right through them and then send us an email saying they had an error.
You could write a routine that timed how long the message box was up, and if they
dismissed it in under, say, a second, then pop it right back up there but double the
mandatory visible time. Could be kind of a fun exercise in dealing with unruly
users, actually. So fun, I just couldn't resist. <eg>
Public Sub InTheirFace(ByVal TheMsg As String, ByVal MinSecs As Double)
Dim Popped As Double
Const OneSec As Double = 1 / 86400
Do
If Popped <> 0 Then MinSecs = MinSecs * 2
Popped = CDbl(Now)
MsgBox TheMsg, vbCritical, "In Your Face!"
Loop Until (Popped + (OneSec * MinSecs)) < CDbl(Now)
End Sub
You could call it with something like:
Call InTheirFace("Report error code XYZ, luser!", 2)
would like to create error trapping that will create an error log for our IT
Department that would give us some information to help track down the error.
for example, something like: "UserName running macro 10-123 generated Error
Description at line #XX. Variables at the time of the error were: Variable
a = "1111", variable b = "", variable c = "abc".
Well, as Tony said, if you want the errorline, you'll need to supply it.