Hi,
I am opening word via VB (code below) and need to know if the user has made
any edits to the doc.
I know I can use wordbasic.isdocumentdirty() in a VBA as below,
Private Sub Document_Close()
If WordBasic.IsDocumentDirty() Then
MsgBox "Doc is dirty"
Else
MsgBox "Doc is not dirty"
End If
End Sub
But I do not want to use a VBA module within the Word doc if I can avoid it.
Is there a way for the calling VB exe to determine IsDocumentDirty() ?
VB code follows:
Dim objApp As New Word.Application
Dim objDoc As Word.Document
objApp.Documents.Open FileName:="C:\temp\test.doc",
AddToRecentFiles:=False
objApp.Visible = True
objApp.Activate
Set objDoc = objApp.ActiveDocument
MsgBox "Click to continue"
objDoc.Close
Andrew Kennard - 07 Jun 2007 17:57 GMT
Check the Saved property for the active document
If it's True the document is NOT dirty
HTH
Andrew
> Hi,
>
[quoted text clipped - 28 lines]
> MsgBox "Click to continue"
> objDoc.Close
kozaw - 08 Jun 2007 06:41 GMT
> Check the Saved property for the active document
>
[quoted text clipped - 36 lines]
> > MsgBox "Click to continue"
> > objDoc.Close
Yes, it is as simple as..
Private Sub CheckingDocSavedOrNot()
If Activedocument.saved = False Then
MsgBox "Doc is dirty"
' you can do saving by >> Activedocument.save
Else
MsgBox "Doc is not dirty"
End If
End Sub
KoZaw