Macro to save file and run existing macro

mpeters102

New Member
Joined
Mar 14, 2009
Messages
10
Hi All,

I have a spreadsheet I use as a template each day to complile information, after I get said info I save it as a file containing the date then I run a macro to format the data and get rid of all un-needed columns/rows ect.

I am trying to set up a marco to run the entire procedure...I have the macro working to save the file as the current day working correctly however when I go into that file and open It does not recoginze my original macro to format the data?

Below is what I have It is telling me it does not recognize the "FormatTrdSheet" Macro even though I know it exists and it typed correctly.

Dim sFileName As String, sPath As String

Application.Run "COMBINED_TRADESHEET_SELL1.xls!SaveasSellSheet" 'with today's date
ActiveWorkbook.Save
ActiveWorkbook.Close
sPath = "F:\Moxy\WRAPTrdshts 2009\"
sFileName = "Selltest" & Format(Now(), "mm_dd")
Workbooks.Open Filename:=(sPath & sFileName)
Sheets("Corp").Select
Application.Run "FormatTrdSheet"
 
If Run.xls is open and Module1 has a Sub called Hi, then from any workbook:
Code:
Application.Run "Run!Module1.Hi"
Remove the "Run!" if you want to run Module1.Hi from its own workbook. e.g
Code:
  Application.Run "Module1.Hi"
This will work even if you have another Sub called Hi in another Module.

Or, do this if there is only one Sub called Hi in ThisWorkbook:
Code:
  Application.Run "Hi"
This will error though if you have the Sub Hi in 2 or more Modules.
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,216,529
Messages
6,131,197
Members
449,634
Latest member
sunilj56

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top