Hi,
How would I change the following code to ensure that the file saves as .xlsx format? (Excel 2013). I had changed the code after the Do command to include the .xlsx extension, but Excel still sees it as a .xls format.
Sub Save_OutputFile() restart_Loop: currDate = Mid(Now(), 7, 4) & “-” & Mid(Now(), 4, 2) & “-” & Left(Now(), 2) FileDate = InputBox(“”, “Report Date”, currDate) Do fName = Application.GetSaveAsFilename(DefaultOutputPath & Left(origReport, Len(origReport) – 4) & “_” & currDate & “.xlsx”) counter = counter + 1 If counter >= 3 Then noSave = MsgBox(“You have chosen to exit without saving” & vbCr & vbCr & “Please confirm this selection”, vbYesNoCancel) If noSave = 2 Then counter = 0 GoTo restart_Loop ElseIf noSave = 7 Then counter = 2 GoTo restart_Loop ElseIf noSave = 6 Then MsgBox (“The file has not been saved”) Exit Sub End If Exit Sub End If Loop Until fName False ActiveWorkbook.SaveAs Filename:=fName End Sub
I have always worked around this, but now the code is being used by others and I don’t want them doing any manual workarounds.
Regards,
Maria