|
Re: Non-Robotics: VBA for Excel?
That seemed to fix the issue, although I'm not sure why. Now I have a problem when saving the file that I can't solve. The code that works just fine for Excel 2007, but not 2013.
My code is as follows:
Private Sub SaveFormattedFile()
'This function saves the workbook in the same location with the .xlsx extension.
Dim NameOfWorkbook As String, FileNameToSave As String 'Declare variable
'Get the filename without the extension.
NameOfWorkbook = Left(ActiveWorkbook.Name, (InStrRev(ActiveWorkbook.Name, ".", -1, vbTextCompare) - 1))
FileNameToSave = NameOfWorkbook & ".xlsx" 'Add the new file extension to save.
'Save the workbook as a .xlsx file.
ActiveWorkbook.SaveAs FileNameToSave, FileFormat:=51
End Sub
|