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

VB/Excel Problem 1

Status
Not open for further replies.

Stewart531

Programmer
Feb 18, 2003
36
US
Is there any way to save a spreadsheet from the vb side before closing it? This is for an automated program, and I don't want to get the message box saying "Do you want to save these changes?". Thanks.
 
Hi,

Try this

dim appli as new Excel.Application
'Excel will be visible, select false if you don't want
appli.visible = true
appli.displayAlerts=false
'If a template exists
Appli.Workbooks.Add App.Path & "\Spread.xls"
'Or
Appli.Workbooks.Add
appli.cells(1,1)="Test"
appli.SaveAs FileName:=app.path & "\Spread2.xls"
'or
appli.save
'or if you want to print
appli.printout
appli.quit
set appli = nothing

I hope it will help you !
Jean
 
Thanks Jean! It was "appli.displayAlerts=false" that did the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top