Thread: [Solved] Problem closing document
View Single Post
 
Old 05-16-2025, 02:22 AM
eduzs eduzs is offline Windows 10 Office 2019
Expert
 
Join Date: May 2017
Posts: 266
eduzs is on a distinguished road
Default Problem closing document

I use Word 2019 + Windows 10, any code that closes the document without saving changes causes Word to crash (closes all open documents, reopen asking for safe mode), a simple example:

Code:
Private Sub Document_Open()
MsgBox "Hi"
Set odoc = ActiveDocument
odoc.Paragraphs(1).Range.Text = "Hi"
odoc.Close savechanges:=wdDoNotSaveChanges
End Sub
It started suddenly.
Only occurs when running from automatic procedure (like Document_Open).
Do not occurs when running by keyboard shortcut.
Does not ocurrs in Office 2010.
I have already tried reinstalling and to update Office.

Any ideas?

Thanks.
__________________
Backup your original file before doing any modification.
Reply With Quote