0
votes

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?

1
Working fine for me (running Windows 7). - Shai Rado

1 Answers

0
votes

I managed to fix it - If I use

FileFormat:=xlTextMSDOS then everything works as expected.