Call SaveSettings

G

Guest

I've almost got this code the way I need it ,But.The point is not to be asked
again once you've answered the Userform and MsgBox. The problem is when I'm
at the UserForm and I have a Commandbutton2 thats a "Remind me Later" when
selected closes the Userform with no data but it still saves the setting and
doesn't open up again untill the next year at that date. Any help at all.
Thanks in Advance:
L = Month(Date) * 10000 + Year(Date)
M = GetSetting("Demo", "Drafts", "Month", 0)
If L = M Then Exit Sub
If Month(Date) = 2 Then
If Day(Date) >= 24 And Day(Date) < 27 Then
UserForm1.Show 'Here is the problem with CommandButton2 I Think
If MsgBox("Do you qualify for Bank Day?", _
vbYesNo) = vbYes Then
MsgBox ("1 Day has been added to your Bank Days")
Call SaveSetting("Demo", "Drafts", "Month", L)
Worksheets("Vacation").Range("C3").Value = 1
Else
Worksheets("Vacation").Range("C3").Value = 0
End If
End If
End If
 
G

Guest

Hi Richard,

Try this:

'Add this variable declaration
Dim Ans as Variant
'this holds the response to your question

To test the response, use it as follows:
Ans = MsgBox("Do you qualify for Bank Day?", vbYesNo)
If Ans = vbYes Then... 'do your thing

If Commandbutton2 is on the userform, then the code for the message and
subsequent response to the question, should be in its Click event. In the
VBE, right-click Commandbutton2 on the userform and select "View Code".

Use something like this to display the userform:
Sub ShowMyForm()
Userform1.Show
End Sub

Once the userform is displayed, it should handle all the code related to its
use.

....hope this helps!
GS
 

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