In Excel 10 I am currently using a short cut key (ctrl+i) that triggers a macro located in workbook A to open workbook B (which is a true template although it can be a regular workbook - I'm not opposed to that).
Workbook B has an Autpen macro that asks the user to name the workbook via a message box then saves the workbook based on cell contents.
I have done some research on this and created the code below which is working except for the fact that when I re-open the saved workbook it fires the Autpen again which messes things up. What can I do to alter the below code or what new code can I use to accomplish this? I want to avoid having to open the saved file from Excel by holding the Shift key. Many thanks.
Workbook A code:
Sub OpenIDS()
'
' OpenIDS Macro
'
' Keyboard Shortcut: Ctrl+i
'
Workbooks.Open Filename:= _
"C:\Users\Administrator\Documents\Custom Decorators\Window Installation Sheet (Garrett).xltm" _
, Editable:=True
ActiveWorkbook.RunAutoMacros xlAutoOpen
End Sub
Workbook B code:
Sub Autpen()
'
' Autpen Macro
'
l = InputBox("Type customer's name & scenario summary:")
Range("G1") = l
ActiveWorkbook.SaveAs Filename:="C:\Users\Administrator\Documents\Custom Decorators\Installation Detail Sheets\" _
& Range("G1").Value & ".xlsm" _
, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
'
End Sub
Workbook B has an Autpen macro that asks the user to name the workbook via a message box then saves the workbook based on cell contents.
I have done some research on this and created the code below which is working except for the fact that when I re-open the saved workbook it fires the Autpen again which messes things up. What can I do to alter the below code or what new code can I use to accomplish this? I want to avoid having to open the saved file from Excel by holding the Shift key. Many thanks.
Workbook A code:
Sub OpenIDS()
'
' OpenIDS Macro
'
' Keyboard Shortcut: Ctrl+i
'
Workbooks.Open Filename:= _
"C:\Users\Administrator\Documents\Custom Decorators\Window Installation Sheet (Garrett).xltm" _
, Editable:=True
ActiveWorkbook.RunAutoMacros xlAutoOpen
End Sub
Workbook B code:
Sub Autpen()
'
' Autpen Macro
'
l = InputBox("Type customer's name & scenario summary:")
Range("G1") = l
ActiveWorkbook.SaveAs Filename:="C:\Users\Administrator\Documents\Custom Decorators\Installation Detail Sheets\" _
& Range("G1").Value & ".xlsm" _
, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
'
End Sub