PDA

View Full Version : Return control after application.run



JMURRAY
02-07-2011, 01:09 PM
I am having a problem returning control to a workbook macro after it calls another macro in a different workbook using the application.run function. The code in the originating workbook is:

Sub CombineFiles()
'call the workbook to pick up and combine all good and fixed files and move them to the integration point.


Sub CombineFiles()
'call the workbook to pick up and combine all good and fixed files and move them to the integration point.


'opening workbook
MsgBox " Going to Combine workbook"

Workbooks.Open FileName:="V:\2011 supply issued\Upload Processor\COMBINE_FILES.xlsm"
Application.Run "COMBINE_FILES.xlsm!GetCleanedFiles"
Application.Run "COMBINE_FILES.xlsm!SummurizeSheets"

MsgBox "Back from combine workbook"

End Sub

It runs both macros fine but does not show the Message from the MsgBox line.

Kenneth Hobs
02-07-2011, 07:23 PM
There are two scenarios where that might happen or appear to happen. (1) End was used in the run code. (2) The MsgBox() was behind a window.

JMURRAY
02-08-2011, 04:33 PM
Kenneth

Thanks for reply. I checked to see if the msgbox was in the background and it does not appear to be. I run this every morning and will confirm tomorrow this is the case. I have added the code from the last macro called. I don't see anywhere an end statement would cause the process to stop but could be missing something.

Thanks
Jeff