I have a vba routine that is not working properly.
I have a current workbook: I need to keep open
I have a second workbook i'm opening...getting additional string for saveas and then I just need to close the saveas workbook.
Current workbook "MyExcel1.xlsx"
In the code below i'm opening another workbook , doing a SaveAs and Then closing it.
but keeping my current workbook open.
THIS CODE IS CLOSING MY CURRENT WORKBOOK ALSO ?
Public Sub CmeSaveAs()
Dim oldwkbk As String
Dim excelwrk As Excel.Application
Dim newdate As String
Dim sInput As String
Set excelwrk = Excel.Application
excelwrk.Workbooks.Open "C:\Program Files\Cme\Template_DoNot_Open\Export_Cme_Template.xlsx"
excelwrk.Visible = False
sInput = InputBox("Enter File name here")
' saveas and then close please
excelwrk.ActiveWorkbook.SaveAs "C:\Program Files\Cme\Cme_Export\" & sInput & "_" & newdate