I have a process that I run on sets of workbooks. I'm trying to modify the filetype when I close the file. I'm trying to tack it onto the end of the process before closing each workbook. Right now, the opened file is in .xlsb. I'm trying to save it in basically any other format (.xsls, etc.)
Whenever I run the Macro the "SaveAs" command errors out. I've tried everything I can think of to have it just save the file with the same name, different filetype, but no luck.
What am I doing wrong?
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Path = ThisWorkbook.Sheets(1).Range("H6")
If Right(Path, 1) <> "\" Then
Path = Path & "\"
End If
wsheet = ThisWorkbook.Sheets(1).Range("F10")
ThisWorkbook.Sheets(3).Range("A2:B20000").ClearContents
OutLn = 2
Line = 1
Do While ThisWorkbook.Sheets(2).Cells(Line, 1) <> ""
OpnFil = ThisWorkbook.Sheets(2).Cells(Line, 1)
Workbooks.Open fileName:=Path & OpnFil, UpdateLinks:=False
ScanLn = 12
Do While ThisWorkbook.Sheets(1).Cells(ScanLn, 5) <> ""
ThisWorkbook.Sheets(3).Cells(OutLn, 1) = OpnFil
Addr = ThisWorkbook.Sheets(1).Cells(ScanLn, 5)
ThisWorkbook.Sheets(3).Cells(OutLn, 2) = Workbooks(OpnFil).Sheets(wsheet).Range(Addr)
OutLn = OutLn + 1
ScanLn = ScanLn + 1
Loop
Workbooks(OpnFil).SaveAs fileName:=Workbooks(OpnFil).GetBaseName, FileFormat:=51
Workbooks(OpnFil).Close
Line = Line + 1
Loop
End Sub```