Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Close excel without prompt

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,63029
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Close excel without prompt
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Close excel without prompt - 8/1/2008 2:20:47 AM   
  boomer

 

Posts: 33
Score: 0
Joined: 6/17/2008
Status: offline
I have a script that exports user data to a spreadsheet.  It needs to update daily.  I am trying to set it up to run as a schedule task but I can not get the script to run without prompts.   Is there a command to save and exit excel without getting a prompt?

When I run my script, I get the following message, "Do you want to save the changes you made to 'test.xls'?

Here is my closing statements:

objExcel.SaveAs "C:\scripts\test.xls"
objExcel.ActiveWorkbook.Close
objExcel.Quit
 
 
Post #: 1
 
 RE: Close excel without prompt - 8/1/2008 3:03:44 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
objExcel.DisplayAlerts = False

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to boomer)
 
 
Post #: 2
 
 RE: Close excel without prompt - 8/1/2008 3:30:45 AM   
  boomer

 

Posts: 33
Score: 0
Joined: 6/17/2008
Status: offline
Hi dm_4ever,

Using your line of code, it stopped the prompt message from coming up, but now it will not save the excel spreadsheet.  It does populate spreadsheet but once it finishes it just exits without prompting a message.  I tried putting code in different order but it still exits without saving the new data. 

objExcel.DisplayAlerts = False
objExcel.SaveAs "C:\scripts\PWDExpiration.xls"
objExcel.ActiveWorkbook.Close
objExcel.Quit

objExcel.SaveAs "C:\scripts\test.xls"
objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.Close
objExcel.Quit

or

objExcel.SaveAs "C:\scripts\PWDExpiration.xls"
objExcel.ActiveWorkbook.Close
objExcel.DisplayAlerts = False
objExcel.Quit

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: Close excel without prompt - 8/1/2008 4:54:47 AM   
  mcds99


Posts: 434
Score: 4
Joined: 2/28/2006
Status: offline
Either prompt or don't.

objExcel.Save
This will save but you will need to have the path/file name before you close.



_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to boomer)
 
 
Post #: 4
 
 RE: Close excel without prompt - 8/1/2008 5:04:12 AM   
  boomer

 

Posts: 33
Score: 0
Joined: 6/17/2008
Status: offline
mdcs99,

I have tried both Save and SaveAs.  I believe the save would work if it was not overwriting existing data. 

Here is the promt message I get:"Do you want to save the changes you made to 'test.xls'?

objExcel.SaveAs "C:\scripts\PWDExpiration.xls"

or

objExcel.Save "C:\scripts\PWDExpiration.xls"

(in reply to mcds99)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Close excel without prompt Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts