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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save an edited Excel file with no user input 1

Status
Not open for further replies.

smithy1981

IS-IT--Management
Sep 16, 2005
12
GB
Hi, I am trying to write to an excel file which i am having no problems doing, but when the program exits and closes the excel file, a prompt appears checking whether or not you wish to save the file.

Is there a way of automatically saving the file without any user input.
 
Greetings!

There are a couple ways you could do this. If you are simply editing an excel file that has already been created, then on your close statement, simply add the word "true"...
Code:
objWBK.Close True

If this is a brand new excel file, then you should save it before closing it with some code like this...
Code:
objWBK.SaveAs "H:\test.xls", True
The "true" parameter here tell the program to overwrite an existing file.

He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top