ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calendar control (https://www.excelbanter.com/excel-programming/314270-calendar-control.html)

msnews.microsoft.com[_6_]

calendar control
 
Hello group,

How can I get the number of the month when the new month event happens,
I'm trying to display a spreadsheet in a userform depending on the month the
user has chosen, see code

'msgbox calendar1.month <- this returns a 0, it does return the month number
only if I click in a new
month but if I select the month in the combo box nothing would happen

Private Sub Calendar1_NewMonth()

If Calendar1.Month = 3 Then
UserForm4.Spreadsheet1.HTMLURL = "H:\Gerardo\p_mar.htm"
ElseIf Calendar1.Month = 2 Then
UserForm4.Spreadsheet1.HTMLURL = "H:\Gerardo\p_feb.htm"
Else
MsgBox "No data was found for selected date", vbExclamation
End If

End Sub

please advice
thanks to all !!
Gerardo



Ron de Bruin

calendar control
 
Hi Gerardo

MsgBox Month(Calendar1.Value)


--
Regards Ron de Bruin
http://www.rondebruin.nl


"msnews.microsoft.com" wrote in message ...
Hello group,

How can I get the number of the month when the new month event happens,
I'm trying to display a spreadsheet in a userform depending on the month the
user has chosen, see code

'msgbox calendar1.month <- this returns a 0, it does return the month number
only if I click in a new
month but if I select the month in the combo box nothing would happen

Private Sub Calendar1_NewMonth()

If Calendar1.Month = 3 Then
UserForm4.Spreadsheet1.HTMLURL = "H:\Gerardo\p_mar.htm"
ElseIf Calendar1.Month = 2 Then
UserForm4.Spreadsheet1.HTMLURL = "H:\Gerardo\p_feb.htm"
Else
MsgBox "No data was found for selected date", vbExclamation
End If

End Sub

please advice
thanks to all !!
Gerardo






All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com