bamaisgreat
Well-known Member
- Joined
- Jan 23, 2012
- Messages
- 831
- Office Version
- 365
- Platform
- Windows
As you can probably tell by looking at the code below, I simply run the code when I have a xlsm file open and it saves it as a xls. A problem Im having is if i accidentally run the code on a xls I will get error at the Kill Filename.
Is there something that could be added at the beginning where a user form would pop up saying the file is a xlsm would you like to convert to xls yes or no. Or if the file is already an xls a userform would pop up saying the file is a xls and contains No Macros and then you could just x out of the userform.
Is there something that could be added at the beginning where a user form would pop up saying the file is a xlsm would you like to convert to xls yes or no. Or if the file is already an xls a userform would pop up saying the file is a xls and contains No Macros and then you could just x out of the userform.
Code:
Sub bomaisgrat()
Dim Fname As String
With ActiveWorkbook
If ActiveWorkbook.FileFormat = 52 Then
Application.DisplayAlerts = False
Fname = .FullName
.SaveAs Replace(.FullName, ".xlsm", ""), 51
Application.DisplayAlerts = True
End If
End With
Kill File name
End Sub