Application.run

Roderick_E

Well-known Member
Joined
Oct 13, 2007
Messages
2,051
I'm running subroutines from another subroutine by using Application.run <string> such as Application.run testmacro
The problem is, there is no error if the macro doesn't actually exist. I could just as well add Application.run thisisbogus and it would appear to do something even though it isn't. How can I put in error trapping? Thanks
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Kenneth Hobson

Well-known Member
Joined
Feb 6, 2007
Messages
3,092
I don't know what you mean. It errors at Compile if you use a variable as you did. If you use a string as I did, it errors at runtime.
Code:
Sub test()
  On Error GoTo msg
  Application.Run "ken"
  Exit Sub
msg:
  MsgBox Err.Number & vbLf & Err.Description
End Sub
 

Roderick_E

Well-known Member
Joined
Oct 13, 2007
Messages
2,051
whooops I have on error resume next for other stuff so it probably isn't trapping there. Thanks for prompting me on that.
 

Watch MrExcel Video

Forum statistics

Threads
1,090,410
Messages
5,414,242
Members
403,522
Latest member
Abel_excel

This Week's Hot Topics

Top