S
Steven
I have a macro in File01.xls that opens File02.xls and then does an
Appliction.Run on the Autpen macro in File02.xls:
Private Sub MacroOpenFile02()
Workbooks.Open Filename:= "C:\File02.xls", Password:="aoaoao"
Application.Run "'C:\File02.xls'!Autpen"
Windows("File01.xls").Close (0)
End Sub
Now when the macro Application.Run "'C:\File02.xls'!Autpen" 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
Appliction.Run on the Autpen macro in File02.xls:
Private Sub MacroOpenFile02()
Workbooks.Open Filename:= "C:\File02.xls", Password:="aoaoao"
Application.Run "'C:\File02.xls'!Autpen"
Windows("File01.xls").Close (0)
End Sub
Now when the macro Application.Run "'C:\File02.xls'!Autpen" 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