View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_4_] Bob Phillips[_4_] is offline
external usenet poster
 
Posts: 834
Default How check if Application.Run fails??

I would turn the macros into function and add error handling to return True
or False depending on success, something like

Public Function TestRun() As Boolean

On Error GoTo TestRun_Error

TestRun = True

'some code that if it errors calls the errorhandler

'such as

Debug.Print 1 / 0

Exit Function

TestRun_Error:
TestRun = False
End Function


and thn call it like so

If Not Application.Run("Personal 2003.xls!TestRun") Then

MsgBox "oops!"
End If


HTH

Bob

"Robert Crandal" wrote in message
...
Hello! I am using Application.Run to run macros in another
workbook that is currently open. How can I check or test
if the Application.Run function call fails or returns an error
code?? Would it also be wise to use the "On Error Resume Next"
before calling the Application.Run function??


thank you!