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: 389
Default Cannot get message box to show

I have a macro in File01.xls that opens File02.xls and then does an
Appliction.Run on the Auto_Open macro in File02.xls:

Private Sub MacroOpenFile02()

Workbooks.Open Filename:= "C:\File02.xls", Password:="aoaoao"
Application.Run "'C:\File02.xls'!Auto_Open"
Windows("File01.xls").Close (0)

End Sub

Now when the macro Application.Run "'C:\File02.xls'!Auto_Open" runs there is
a test in the code that depeding on the result, I may close the file with
Windows("File02.xls").Close(0) ; Now it returns back to continue in macro
in File01.xls I think but I want to put up a message saying File02.xls has an
error and cannot be open. I have made it work in File02.xls by putting the
MsgBox code line right before the Close(0) code line. But that means
File02.xls is open behind the MsgBox. When the user clicks ok on the MsgBox
it closes the file, but what I want is if there was an error for File02.xls,
that it closes so the user will not see File02.xls ... and then return to
File01.xls macro and show a MsgBox from File01.xls macro.

How do I accomplish this?

Thank you,

Steven
 
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
Show a message but not in MsgBox RobN[_2_] Excel Discussion (Misc queries) 2 May 30th 08 11:58 PM
message box does not show Marilyn Excel Discussion (Misc queries) 2 May 15th 08 11:44 PM
If A0, I need a message pop-up box to show text in B1 [email protected] Excel Programming 4 December 31st 06 11:04 PM
Message box to show cell value scottwilsonx[_29_] Excel Programming 4 September 7th 04 10:59 AM
show message Mark Kubicki Excel Programming 6 December 19th 03 01:54 PM


All times are GMT +1. The time now is 08:10 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"