reset the value of a spin button

C

cubbybear3

Q: How can I reset the value of a spin button with out setting off the
CHANGE event?
I am using Office Pro 2003 and have tried the following with out
success:

Application.EnableEvents = False
spnButton1.Value = VarX
Application.EnableEvents = True
 
B

Bob Phillips

Option Explicit

Private fNoChange As Boolean

'other code

Private Sub spnButton1_Change()
If Not fNoChange Then

'change code
End If
End Sub


'more code

fNoChange = True
spnButton1.Value = VarX
fNoChange = False
 
C

cubbybear3

Option Explicit

Private fNoChange As Boolean

'other code

Private Sub spnButton1_Change()
    If Not fNoChange Then

        'change code
    End If
End Sub

'more code

fNoChange = True
spnButton1.Value = VarX
fNoChange = False

--

HTH

Bob

Well, I still haven't figured out EXACTLY how it works, but it
does.
Mucho gracias Bob.
 
B

Bob Phillips

Basically, I am adding my own version of enableevents by using a boolean
variable to determine whether the code executes or not.

--

HTH

Bob

Option Explicit

Private fNoChange As Boolean

'other code

Private Sub spnButton1_Change()
If Not fNoChange Then

'change code
End If
End Sub

'more code

fNoChange = True
spnButton1.Value = VarX
fNoChange = False

--

HTH

Bob

Well, I still haven't figured out EXACTLY how it works, but it
does.
Mucho gracias Bob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top