Jump to content

Recommended Posts

Posted

I find it strange that when closing an Excel workbook, where as the workbook has been opened in ReadOnly mode, I  get the question to Save the workbook.

Indeed, as ReadOnly has been requested, Saving the Workbook should never happen.

This is the code where saving is always requested:

Local $oExcel = _Excel_Open(False,  False,  False,  False,  True) ; Visible, Alerts, ScreenUpdate, Interactive, ForceNew
Local $oWorkbook = _Excel_BookOpen($oExcel, "I:\BOEIC_1887_Bulletin.xls", True,  False) ; ReadOnly, Visible
_DebugOut("Workbook Saved flag =" &  $oWorkbook.Saved)
 
;$oWorkbook.Saved = True
_Excel_BookClose($oWorkbook, False) ; Save
_Excel_Close($oExcel,  False, True) ; Save, ForceClose

The only way I found to avoid the question to save is to set $oWorkbook.Saved variable to True (as in comment in example).

Then and only then I could close the a silent Workbook close

Is there a better way to force a "silent" WB close without save?

Screenshot 2026-02-26 153323.png

Posted

What happens when you set visibility to True in _ExcelBookOpen?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

If I use :

Local $oExcel = _Excel_Open(True,  False,  False,  False,  True) ; Visible, Alerts, ScreenUpdate, Interactive, ForceNew

Or set the visiblity flag manually

$oExcel.Visible = True

No change, the "Save" inquiry window still appears, but now I get (only) an Excel background window (without the Workbook visible ???).

 

 

Posted

I'm unable to reproduce your problem!

Which version of Excel do you run?
Could you translate your XLS workbook to XLSX and test again?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

Check if your file has formula functions (e.g. =NOW(), =TODAY(), =RAND()), which are recalculated when the file is opened.


Edit:
$oExcel.DisplayAlerts = False  ; Force silent close

 

Edited by ioa747

I know that I know nothing

Posted (edited)

I wonder if a field is automatically updating? In LibreOffice Calc at least, fields/formulas still can update even in Read-Only mode. Which would still set the modified status to True.

Is there a way to open the workbook without Auto-Update of fields?

Edit: @ioa747 beat me to it. :)

Edited by donnyh13

LibreOffice UDF  

Scite4AutoIt Spell-Checker Using LibreOffice

WPS Office adapter — Use MS Word UDFs with WPS Office!

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Posted

Office16 alias Excel 2021

However, that xls had VBA functions and VBA Forms.

Using xlsx instead xls avoids that query window when closing the Workbook.

But

using the xls, stripped from the VBA procedures and Forms also solves this issue without the trick

$oWorkbook.Saved = True

 

FYI in attachment the xls giving the problem.

 

BOEIC_1887_Bulletin.xls

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...