Saving 2 resulting files from 2 Template files at once with Macros and Buttons removed

ThunderGod

New Member
Joined
May 31, 2012
Messages
7
I have created 2 Template files (xltm). For my purposes here one is named Master.xltm the other is named EmailFile.xltm. EmailFile.xltm is referencing Master.xltm ie: =[Master.xltm]sheet1!C$6$ . Both of these files are opened at once via Auto_Open Macro in Master.xltm. Once the data is entered into Master.xltm it updates EmailFile.xltm. I have a macro in Master.xltm that saves the file as a cell value, which is okay for the Master.xltm workbook. What I am trying to do is save not only the Master.xltm file but also the EmailFile.xltm as well as xlsx files and remove all Macros and Buttons from the saved files and remove all formulas but retain the Values. The resulting file from EmailFile.xltm will be emailed.
I am wanting the files names to be similar to the example below.

File_For_09-07-2012.xlsx (derived from Master.xltm)
Email_File_09-07-2012.xlsx (derived from EmailFile.xltm)
I want to be able to do this by using the Button I created in Master.xltm

The 2 macros I have in Master.xltm are coded below.

I have created a Button in Master.xltm to run the File Save.

FileSave Macro
Code:
Sub FileSave()
      
    Dim Variable1 As String
    Dim Variable2 As String
    
         Variable1 = Sheets("Sheet1").Range("C6").Value + 12
         Variable2 = Format(Variable1, "mm-dd-yyyy")
    
Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:="C:\Excel Testing Folder\" & "File_For_" & Variable2, _
        Password:="", WriteResPassword:="", _
        ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True


End Sub

Auto_Open Macro created with Macro recorder

Code:
Sub Auto_Open()'
' Auto_Open Macro
'


'
    ChDir "C:\Excel Testing Folder"
    Workbooks.Open Filename:= _
        "C:\Excel Testing Folder\EmailFile.xltm", Editable:=True
End Sub

I hope I clarified what I am trying to do.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,215,223
Messages
6,123,714
Members
449,118
Latest member
MichealRed

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