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"
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
have you tried stepping through the macro and making sure the workbook with the macro isn't getting closed?
 
Upvote 0
I am not sure that your workbook is opening. You have defined the workbook to open as: "F:\Moxy\WRAPTrdshts 2009\Selltest03_16"

It would be best to add a file extension like ".xls".

If it does open, is that the workbook that contains the Module with a macro named FormatTrdSheet?
 
Upvote 0
I have stepped through it and it does open the correct spreadsheet (the one I saved using the code in the original post), when I get to the line of code telling it to run the existing macro which formats my data it is telling me it does not recognize the macro.
 
Upvote 0
is it truly a macro? Or perhaps a sheet code? When you are stepping through the macro, just before it gets to that line, do a tools - macro - macros. Do you see it?
 
Upvote 0
The last line of code is the one that is not working, all I am trying to do with it is run a macro in the spreadsheet that I know exists
 
Upvote 0
Post the code so we can see. It is in a Module right? There are no others with the same name?

Have you tried setting the Module name with it?

You can post an example xls to a free shared site like 4shared.com if needed.
 
Upvote 0
Before I got to the line of code which is supposed to run the macro, I took your suggestion and when to tools>Macro>Macros and it was there....This is really puzzling???

Thanks for thoughts, if you have time more are appreciated!!
 
Upvote 0

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

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