J
James
Hello NG,
I have a macro that is associated with a check box from the "forms" tools,
and if it is clicked then the "Run macro on Entry" of the check box.
If someone changes their mind and deselects chbox and then selects it again
the macro runs again.
How can I get the macro to only run once.
I've tried to create a flag and set it to 1 if the macro has already run,
but that doesn't seem to work for me,
any suggestions.
James
'Code begins here============
Private Sub Document_Open()
Dim wdFlag As Integer
wdFlag = 0
End Sub
Sub Color()
'
' Color Macro
' Created: Nov. 9th 2004
' Author: James
' Purpose: Informs customer of printer purchase options
'
If wdFlag = 0 Then
Selection.EndKey Unit:=wdStory
Selection.Font.Color = wdColorDarkBlue
Selection.TypeText Text:= _
"We can help you purchase an inkjet printer at a substantial "
Selection.TypeText Text:="discount!" & Chr(11) & _
"Please call Liz at 555-1234 for more information!"
wdFlag = 1
Else
Exit Sub
End If
End Sub
'Code ends here===========
I have a macro that is associated with a check box from the "forms" tools,
and if it is clicked then the "Run macro on Entry" of the check box.
If someone changes their mind and deselects chbox and then selects it again
the macro runs again.
How can I get the macro to only run once.
I've tried to create a flag and set it to 1 if the macro has already run,
but that doesn't seem to work for me,
any suggestions.
James
'Code begins here============
Private Sub Document_Open()
Dim wdFlag As Integer
wdFlag = 0
End Sub
Sub Color()
'
' Color Macro
' Created: Nov. 9th 2004
' Author: James
' Purpose: Informs customer of printer purchase options
'
If wdFlag = 0 Then
Selection.EndKey Unit:=wdStory
Selection.Font.Color = wdColorDarkBlue
Selection.TypeText Text:= _
"We can help you purchase an inkjet printer at a substantial "
Selection.TypeText Text:="discount!" & Chr(11) & _
"Please call Liz at 555-1234 for more information!"
wdFlag = 1
Else
Exit Sub
End If
End Sub
'Code ends here===========