I have created a template named “Stock Quantity Calculator 2007 Template 10K a2.xltm” with many macro in it. When opening a new workbook with this template I am getting errors because some of the code is looking for the template name not the newly created workbook name.
What would be the code to replace the original workbook name with the current\active workbook name? As you can see it occurs (2) times in this one macro.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
Sub O_All_Button()
'
' O_All_Button Macro
'
<o></o>
'
Application.Run _
"'Stock Quantity Calculator 2007 Template 10K a2.xltm'!UnHide_all"
<o></o>
Sheets("0 Usage Data By Sto-Loc").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Branch Numbers").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Format Data MRP ").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Upload MRP").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Upload MRP RDC").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Format Data RDC").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("0 Stock Cost").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Input Cost Data").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("STO Cost").Select
ActiveWindow.SelectedSheets.Visible = False
Application.Run _
"'Stock Quantity Calculator 2007 Template 10K a2.xltm'!O_Usage_All_SLoc"
Sheets("0 Usage Data ALL Sto-Loc").Select
ActiveWindow.SelectedSheets.Visible = False
End Sub
What would be the code to replace the original workbook name with the current\active workbook name? As you can see it occurs (2) times in this one macro.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
Sub O_All_Button()
'
' O_All_Button Macro
'
<o></o>
'
Application.Run _
"'Stock Quantity Calculator 2007 Template 10K a2.xltm'!UnHide_all"
<o></o>
Sheets("0 Usage Data By Sto-Loc").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Branch Numbers").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Format Data MRP ").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Upload MRP").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Upload MRP RDC").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Format Data RDC").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("0 Stock Cost").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Input Cost Data").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("STO Cost").Select
ActiveWindow.SelectedSheets.Visible = False
Application.Run _
"'Stock Quantity Calculator 2007 Template 10K a2.xltm'!O_Usage_All_SLoc"
Sheets("0 Usage Data ALL Sto-Loc").Select
ActiveWindow.SelectedSheets.Visible = False
End Sub