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
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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
 
Upvote 0
whooops I have on error resume next for other stuff so it probably isn't trapping there. Thanks for prompting me on that.
 
Upvote 0

Forum statistics

Threads
1,214,883
Messages
6,122,077
Members
449,064
Latest member
MattDRT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top