Save an excel file in vbscript without user prompt

M

mattsmith2

Hi, I am trying to edit an excel spreadsheet and then close it using
vbscript.

the script currently edits the data fine, but when it closes, it gives
the Save prompt. Is there a way to close the spreadsheet saving the new
data automatically without any user input

Thanks
 
S

Steve Yandl

At the start of your script, place the line

Const xlSaveChanges = 1

Assuming the workbook object you've created is named objWorkbook and the
application object is named objExcel, finish your script with

objWorkbook.Close xlSaveChanges
objExcel.Quit

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top