Hi,
I am trying to save a workbook after macro has run as .xlsx so that same file can be sent to users without macro, but if I use below code it throws error
[code]
Dim ThisFile As String
ThisFile = "Regulatory Reporting " & Format(Range("G21").Value, "dd.MMM") & ".xlsx"
MsgBox ThisFile
ActiveWorkbook.SaveAs Filename:=ThisFile
[\code]
and if changed as below (.xlsm) then it works without any trouble
[code]
Dim ThisFile As String
ThisFile = "Regulatory Reporting " & Format(Range("G21").Value, "dd.MMM") & ".xlsm"
MsgBox ThisFile
ActiveWorkbook.SaveAs Filename:=ThisFile
[\code]
Any Idea how can I change the file type ?
Last edited by Blue_kul; 01-04-2012 at 09:38 PM.
I think you need to specify the fileformat (51 for macro-free workbook)
Sub Test() Application.DisplayAlerts = False Dim ThisFile As String ThisFile = ActiveWorkbook.Path & "\Regulatory Reporting " & Format(Range("G21").Value, "dd.MMM") & ".xlsx" ActiveWorkbook.SaveAs Filename:=ThisFile, FileFormat:=51 Application.DisplayAlerts = True End Sub
To thank someone who has helped you, click on the star icon below their name.
I hate reading
Portfolio
I need a job.I am young and incompetent
Hi
It's the last bit that specified the type of workbook you want to saveas.ActiveWorkbook.SaveAs Filename:=ThisFile, FileFormat:=xlOpenXMLWorkbook
It Worked .... Thanks !!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks