joshman108
Active Member
- Joined
- Jul 6, 2016
- Messages
- 310
Here is my simple code, found online.
It will succeed in opening a new workbook, pasting the data from original sheet1 and will actually name the new file "TEST". But I get hit with
and when I check the desktop I see that it has failed to actually save. Any ideas on why?
Thanks!
Code:
Sub test2()
' copies a worksheet into a new file and saves it onto desktop
Dim newWB As Workbook
Sheets("Sheet1").Select
'Add a new workbook and copy the Members sheet over
Set newWB = Workbooks.Add
ThisWorkbook.Sheets("Sheet1").Copy Before:=newWB.Sheets(1)
'this saves the new workbook
With newWB
.SaveAs Filename:="Macintosh HD:Users:josh.flori:Desktop:TEST.xlsx", FileFormat:=xlCSV, CreateBackup:=False
.Saved = True
.Close
End With
End Sub
It will succeed in opening a new workbook, pasting the data from original sheet1 and will actually name the new file "TEST". But I get hit with
Code:
Run-time error '1004':
Application-defined or object-defined error
and when I check the desktop I see that it has failed to actually save. Any ideas on why?
Thanks!
Last edited: