Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

18120 Posts in 4741 Topics- by 31743 Members - Latest Member: suuraj
 

Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: .quit still asks if I want to save    (Read 347 times)
joe loyzaga
FRProject
Advanced User
*
Offline Offline

Posts: 515

I live in Sydney


« on: March 03, 2010, 10:45:50 PM »

opens an excel worksheet - but when I call xl.quit it stills prompts with a dialog box whether to save - but I don't want it EVER to save - is there a way to open read only? or force no save?


   Set xl = CreateObject("Excel.Application")
   If Err.Number <> 0 Then
      MsgBox "Failed to initiate Excel." & vbCrLf &  "This operation requires Excel to be installed.", vbCritical
      Exit Function
   End If

   ' Open specified workbook   
   xl.Workbooks.Open(sFileName)
   If Err.Number <> 0 Then
      MsgBox "Specified Excel file '" & sFileName & "'." & vbCrLf & "Make sure the file name is correct.", vbCritical
      xl.Quit
Logged
Gautham Maroli
FRProject
Full User
*
Offline Offline

Posts: 155


« Reply #1 on: March 03, 2010, 10:52:43 PM »

you can use:
xl.DisplayAlerts = false
Logged
Tarun Lalwani
Advanced User
*****
Offline Offline

Posts: 854



WWW
« Reply #2 on: March 03, 2010, 10:55:46 PM »

Well if you make a change then the prompt would come. To avoid you should close the workbook before quitting

xl.Workbooks.Close False 'Close and don't save
Logged

Tarun Lalwani,
QuickTest Professional Unplugged - My new Book on QTP...
Pages: [1]   Go Up
Print
Jump to: