jordanburch
Active Member
- Joined
- Jun 10, 2016
- Messages
- 402
- Office Version
- 2016
hello,
I have the below. It basically saves the file to get rid of digital signatures and the file being marked as final. I need to be able to access the file with vba so im trying to save it to get rid of the permissions restrictions. The cod runs however when I try and open the saved file it give the file format or extension is not valid error message. I have tried to save as .xls .xlsx .xlsm and non seem to work. Any thoughts?
Jordan
I have the below. It basically saves the file to get rid of digital signatures and the file being marked as final. I need to be able to access the file with vba so im trying to save it to get rid of the permissions restrictions. The cod runs however when I try and open the saved file it give the file format or extension is not valid error message. I have tried to save as .xls .xlsx .xlsm and non seem to work. Any thoughts?
VBA Code:
Sub ChangeFileFormat()
Dim Folder As String, FileName As String, folder2 As String
Dim wb As Workbook
Application.DisplayAlerts = False
Folder = "C:\Users\jordan.burch.ctr\Desktop\CERT STATEMENTS 3\"
folder2 = "C:\Users\jordan.burch.ctr\Desktop\CERT STATEMENTS\"
FileName = Dir(Folder & "*.xls*", vbNormal)
On Error GoTo exitsub
With Application
.EnableEvents = False: .ScreenUpdating = False
End With
Do While FileName <> ""
Set wb = Workbooks.Open(Folder & FileName)
FileName = Replace(FileName, ".xls*", ".xlsm")
If FileName <> ThisWorkbook.Name Then
wb.SaveAs FileName:=folder2 & FileName, FileFormat:= _
xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End If
wb.Close False
FileName = Dir
Set wb = Nothing
Loop
exitsub:
With Application
.EnableEvents = True: .ScreenUpdating = True
End With
If Err > 0 Then MsgBox (Error(Err)), 48, "error"
Application.DisplayAlerts = True
End Sub
Jordan
Last edited by a moderator: