J
JMay
Just playing around to be warned if a file has been altered in any way (dirty).
Somehow if before closing I switch to the VBE envirnoment - I see 2
representions of the file complete with sheet1, sheet2, sheet3, thisworkbook
and module1
In module1 I only have
Public mFlag
I'm probably violating some rule causing this - can someone comment on this?
TIA
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If mFlag = True Then
MsgBox "You have altered your file"
Else
MsgBox "You have NOT altered your file"
End If
End Sub
Private Sub Workbook_Open()
Dim mFlag As Boolean
mFlag = False
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
mFlag = True
End Sub
Somehow if before closing I switch to the VBE envirnoment - I see 2
representions of the file complete with sheet1, sheet2, sheet3, thisworkbook
and module1
In module1 I only have
Public mFlag
I'm probably violating some rule causing this - can someone comment on this?
TIA
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If mFlag = True Then
MsgBox "You have altered your file"
Else
MsgBox "You have NOT altered your file"
End If
End Sub
Private Sub Workbook_Open()
Dim mFlag As Boolean
mFlag = False
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
mFlag = True
End Sub