Need Help understanding code

R

Richard

This code works great but there are several things that I
just don't understand. Can Anyone please help.
First - I understand the Dim, what is the * 10000 for?
Second - GetSetting("Demo", "Drafts", "Month", 0) There is
no where in my workbook that refers to "Demo",
Drafts", "Month", and what does the 0 do?
Third - SaveSetting is that saving both the L and the M
when I click the Yes buttom
Private Sub Workbook_Open()
Dim L As Long, M As Long
L = Month(Date) * 10000 + Year(Date)
M = GetSetting("Demo", "Drafts", "Month", 0)
If L = M Then Exit Sub
If Day(Date) >= 10 And Day(Date) < 15 Then
If MsgBox( _
"Have you posted your drafts for Golds Gym
($28.00)" & _
"and NetZero ($9.95) for the 15th.!", _
vbYesNo, "Automatic Drafts Reminder") = vbYes Then
Call SaveSetting("Demo", "Drafts", "Month", L)
End If
End If
End Sub
 
B

Bob Phillips

Richard,

* 10000 - multiply by 10000

GetSetting - look in help, you will learn better this way
SaveSetting - ditto

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
R

Richard

But why does it need to multiply by 10000?
-----Original Message-----
Richard,

* 10000 - multiply by 10000

GetSetting - look in help, you will learn better this way
SaveSetting - ditto

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)




.
 
T

Tushar Mehta

Take any month and any year (up to 9999). What do you get if you
multiply the month by 10000 and add the year? Is it an unique way to
identify a particular month in a particular year?

What would happen if you used 1000 instead of 10000? Would the result
still be unqiue?

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
B

Bob Phillips

It doesn't need to, it is simply a way of getting a unique(ish) number based
upon the month number and year.

Thinks about it, if you just add the year and month, is 2005 a year of 2003
and a month of 2, or a year of 2002 and a month of 3, or .... Whereas 22004
can only be a month of 2 and a year of 2004.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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