dominique Posted 7 hours ago Posted 7 hours ago 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?
water Posted 7 hours ago Posted 7 hours ago 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
dominique Posted 3 hours ago Author Posted 3 hours ago 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 ???).
water Posted 2 hours ago Posted 2 hours ago 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
ioa747 Posted 1 hour ago Posted 1 hour ago (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 1 hour ago by ioa747 donnyh13 1 I know that I know nothing
donnyh13 Posted 1 hour ago Posted 1 hour ago (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 1 hour ago by donnyh13 ioa747 1 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."
dominique Posted 1 hour ago Author Posted 1 hour ago 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now