Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save As Difficulty: Runtime Error 1004

Status
Not open for further replies.

kvogt2

Technical User
Oct 29, 2002
6
0
0
US
I am currently attemping to save a file (save or overwrite if there is an existing file in this directory) to a specified path via this code:

fname = "L:\GlobalscSh\Data Standards Documentation\GSC QA\" & ThisWorkbook.Name
Application.DisplayAlerts = False
ThisWorkbook.SaveAs fname
ThisWorkbook.Close
Application.DisplayAlerts = True

Each time I execute the code, it returns:

Run-time Error 1004
Application or Object Defined error.

I am confused why this code is not working. I would appreciate any and all advice.

Thanx
Kevin Vogt
 
the code is correct...most the error is becuase it cannot find the path, or folder u are specifying!

therefore i would double check the path and this should work!

Note: Caps make no difference, most likely a spelling mistake
 
Hi Kevin

I just want to inform you, that the line
Application.DisplayAlerts = True
at the end of the code won't be executed, because the "ThisWorkbook.Close" closes the book, in which the running code is. Closing the book stops code execution.

Philipp
 
Ramzi and PVW,

Thank you for the tips, the error was contained in the path name. I was missing one letter!! ugh!! I checked prior to posting and didn't catch it. Thanks for the quick responses.

Kevin.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top