Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi all, Need some syntax help here. How do you add a calendar control to a runtime-built userform? I can do it with some code I snipped from somewhere for standard MS controls ala: Code: -------------------- Function CreateForm Dim TempForm As Object Dim OKButton as MSForms.CommandButton Dim Code as String Set OKButton = TempForm.Designer.Controls.Add("forms.CommandButto n.1")' *** With OKButton .caption = "OK" .Height = 18 .Width = 44 .Left = 10 .Top = 10 End With 'insert additional code to set size of form 'following code defines actions on click: Code = "" Code = Code & Sub OKButton_click()" & vbCrLf Code = Code & " Unload Me" & vbCrLf Code = Code & "End Sub" & vbCrLf 'Show the form VBA.UserForms.Add(TempForm.Name).Show 'Delete the form ThisWorkbook.VBProject.VBComponents.Remove VBComponent:=TempForm End Function -------------------- I have successfully Dim'ed the calendar ala: Dim NewCalendar as MSACal.Calendar but I can't seem to actually add the control. I believe my problem is at the *** above and getting the right syntax for adding the calendar with a similar block. When the code runs, no form is created but no error is thrown. When I remove the calendar-specific code, the form is created properly. Any help would be most appreciated! -- Ouka ------------------------------------------------------------------------ Ouka's Profile: http://www.excelforum.com/member.php...o&userid=23988 View this thread: http://www.excelforum.com/showthread...hreadid=396719 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Userform runtime controls & Macs | Excel Programming | |||
Adding controls to userform | Excel Programming | |||
Removing Controls at RunTime? | Excel Programming | |||
How to create controls at runtime | Excel Programming | |||
creating controls at runtime | Excel Programming |