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 eexcel issue

Status
Not open for further replies.

DrewConn

Programmer
Jan 8, 2002
167
US
I am running this module as a stand alone .exe to auto refresh an excel file. The problem is how do I avoid the save prompt from appearing to make it fully automatic?

Public Sub ExcelRefresh()
Set objExcel = New Excel.Application
objExcel.Visible = False
objExcel.DisplayAlerts = False
Set objworkbook = objExcel.Workbooks.Open("S:\Charge Off Forcasting\Gain-Loss Dump File\Weekly Gain Loss Report.xls")
objExcel.Cells(4, 1).Select
objExcel.Selection.QueryTable.Refresh BackgroundQuery:=False
objworkbook.Save
objworkbook.Close
objExcel.Quit

Set objworkbook = Nothing
Set objExcel = Nothing
End Sub


Any help is appreciated
 
objworkbook.Close savechanges:=True

should do it

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Still get a save as prompt using this command.
 
Seems to work OK for me on VB6, XP pro and Excel on Office XP. I have used the same routine to close Excel silently for several years with other versions

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
I am not sure whether this property exists in your environment, but can you try :

objworkbook.Saved = True

just before

objworkbook.Close

Hoping this helps.

Droops
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top