mksilk
asked on
IsDirty
I have a file that has an Auto_Open macro attached to it that defines the page width etc for the workbook. The trouble is on closing, without performing any actions, Excel thinks the user has changed the file so it prompts for the user to save. I want Excel not to prompt for save unless the user does anything, ie disregard the Auto_Open macro as changes. I believe there is a ISDIRTY method (?) that can be used...
ASKER
Comes up with an error saying Object does not support that property and highlights the Selection.wholestory line.
Woops sorry I wrote it for Word....
Try this
On Error GoTo err_test
Cells.Select
Selection.FindNext(After:= ActiveCell ).Activate
err_test:
If Err.Number = 91 Then
ActiveWorkbook.Close SaveChanges:=False
Exit Sub
End If
ActiveWorkbook.Close SaveChanges:=True
On Error GoTo err_test
Cells.Select
Selection.FindNext(After:=
err_test:
If Err.Number = 91 Then
ActiveWorkbook.Close SaveChanges:=False
Exit Sub
End If
ActiveWorkbook.Close SaveChanges:=True
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Soooooooo simple....but it works! Thanks for that. Should of thought of it myself, Doh!
:o)
You're welcome, mksilk.
/Ture
You're welcome, mksilk.
/Ture
Private Sub Document_Close()
Dim varText
Selection.WholeStory
varText = Len(Selection)
If varText > 1 Then
ActiveDocument.Close SaveChanges:=wdPromptToSav
End If
ActiveDocument.Close SaveChanges:=wdDoNotSaveCh
End Sub
Cheers
Marcus