Hi,
I have the following script, but when I run it it closes the workbook...for some odd reason. Please can anyone tell me why it is doing that and how to stop it from closing?
I want it to save but then tokeep the file/workbook open afterwards.
Sub Save_As()
Application.ScreenUpdating = False
Application.DisplayAlerts = True
' Save report as xlsx and csv format
Dim FIMV As Workbook, path As String
Set FIMV = ThisWorkbook
FIMV.Sheets("Summary").Buttons.Delete
path = "M:\Fixed Income\Fixed Income Pacer\Holding Position\As of " & Right(FIMV.Sheets("Summary").Cells(2, 13), 6)
ActiveWorkbook.SaveAs path & ".xlsx", FileFormat:=xlOpenXMLWorkbook
FIMV.Sheets("CADBONDS").Activate
FIMV.Sheets("CADBONDS").Columns("I:L").Delete
ActiveWorkbook.SaveAs "M:\Fixed Income\Fixed Income Pacer\Holding Position\universe.csv", FileFormat:=xlCSV
FIMV.Sheets("Longbond").Activate
FIMV.Sheets("Longbond").Columns("I:L").Delete
ActiveWorkbook.SaveAs "M:\Fixed Income\Fixed Income Pacer\Holding Position\long.csv", FileFormat:=xlCSV
Application.DisplayAlerts = True
FIMV.Save
End Sub
I have the following script, but when I run it it closes the workbook...for some odd reason. Please can anyone tell me why it is doing that and how to stop it from closing?
I want it to save but then tokeep the file/workbook open afterwards.
Sub Save_As()
Application.ScreenUpdating = False
Application.DisplayAlerts = True
' Save report as xlsx and csv format
Dim FIMV As Workbook, path As String
Set FIMV = ThisWorkbook
FIMV.Sheets("Summary").Buttons.Delete
path = "M:\Fixed Income\Fixed Income Pacer\Holding Position\As of " & Right(FIMV.Sheets("Summary").Cells(2, 13), 6)
ActiveWorkbook.SaveAs path & ".xlsx", FileFormat:=xlOpenXMLWorkbook
FIMV.Sheets("CADBONDS").Activate
FIMV.Sheets("CADBONDS").Columns("I:L").Delete
ActiveWorkbook.SaveAs "M:\Fixed Income\Fixed Income Pacer\Holding Position\universe.csv", FileFormat:=xlCSV
FIMV.Sheets("Longbond").Activate
FIMV.Sheets("Longbond").Columns("I:L").Delete
ActiveWorkbook.SaveAs "M:\Fixed Income\Fixed Income Pacer\Holding Position\long.csv", FileFormat:=xlCSV
Application.DisplayAlerts = True
FIMV.Save
End Sub