View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Clif McIrvin[_3_] Clif McIrvin[_3_] is offline
external usenet poster
 
Posts: 203
Default Excel 2003/vbx macro errors.

"Phil B" <phil.remove.brady@hotmail dot co dot united kingdom wrote in
message ...
I'm developing some vba macros under excel 2003 and am (naturally)
getting errors.
Compile time errors highlight the offending line, but seemingly not
run time errors.

All I'm getting is a helpful message eg 'Invalid procedure call or
argument' but no clue as to which line of code is giving this.
Isn't it possible to get the environment to highlight the offending
source line?
There must be a better way than a liberal sprinkling of print and
msgbox diagnostics.



Hi Phil - are you using [ On Error .... ] statements in your code? For
initial debugging you might comment them all out so that VBA will give
you the option of dropping into the debugger on an error ... and then
the error line will be highlighted for you.

If that doesn't help, the message indicates that your code is calling a
sub or function and the call is failing ... perhaps you wrote the
procedure with a required parameter and your call isn't providing it.

My standard technique for tracking down " strange " errors is exactly
what you mention .. judicious (liberal ?) use of debug.print (I
sometimes use msgbox, but generally prefer the print. You should be
able to identify "milestones" in your code this way, and narrow down
your investigation area.

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)