I'm running the below code and get the "subscript out of range" error on the workbook close line:
Sub SaveFileAs()
With Workbooks.Open(path & "\" & filename).Worksheets("Sheet 1")
.SaveAs path & "\" & "test.woe", _
FileFormat:=xlTextWindows, _
CreateBackup:=False
End With
Workbooks("test.woe").Close SaveChanges:=True
End Sub
However if i change FileFormat:=xlTextWindows into FileFormat:=xlTextMac, then I can close the file. I'm using windows 10. Can anyone please explain why this happens?