LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default On Error doesn't trap Application.Run error

I have a macro in an XLA that is trying to run a macro in a different
workbook, if the macro does not exist, I just want to ignore it and continue,
otherwise run it.

It works fine if the macro exists, but if it doesn't I get the runtime 1004
error dialog box, and no matter what I do, I cannot seem to prevent it.
Here is a sample of my code:

Public Sub RunMacro( FileName )
On Error GoTo Finish
Set ReportWorkbook = Workbooks.Open(FileName, , True)
Application.Run ReportWorkbook.Name & "!Execute"
On Error GoTo 0
Finish:
End Sub

Am I missing something here????
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trap a find error quartz[_2_] Excel Programming 2 December 10th 04 01:21 AM
Error Trap Not Working Otto Moehrbach[_6_] Excel Programming 7 April 13th 04 12:15 PM
Trap a DateValue Error Otto Moehrbach[_6_] Excel Programming 2 February 12th 04 04:51 PM
error trap Rhonda[_3_] Excel Programming 2 October 22nd 03 07:07 PM


All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"