![]() |
Programmactically add calendar control to userform
Hi all,
I'm trying to write a patch for a program of mine. The program uses Calendar Control 9.0 and is installed on a network drive. A copy of MSCal.OCX has been added to the same folder. The program is intended to be used by several people in the office. Unfortunately, apparently many don't have the calendar control file and/or don't have it registered. This causes an error message and causes the calendar control to disappear from the userform when the program is opened. I have successfully fixed the problem manually for one computer but it is impractical to do this for the entire office. It is uncertain how many and whom will end up using it. I'm hoping I can write a patch that will check for the calendar control and, if not found, register the file (on the network drive) and programmatically add it to the userform. I know how to use the Shell command to automatically run Regsvr32 and register the calendar control. I also know how to programmatically add a reference to the VBA Extensibility Library. However, I've been unsuccessful at programmatically adding the control to the userform. Hoping someone can help or suggest a better solution. Best regards, Greg |
Programmactically add calendar control to userform
I finally got it to work. I'm still interested in any better solutions than
the patch idea. This worked: With Application.VBE.ActiveVBProject.VBComponents("User form1").Designer .Controls.Add("MSCal.Calendar.7") End With Regards, Greg "Greg Wilson" wrote: Hi all, I'm trying to write a patch for a program of mine. The program uses Calendar Control 9.0 and is installed on a network drive. A copy of MSCal.OCX has been added to the same folder. The program is intended to be used by several people in the office. Unfortunately, apparently many don't have the calendar control file and/or don't have it registered. This causes an error message and causes the calendar control to disappear from the userform when the program is opened. I have successfully fixed the problem manually for one computer but it is impractical to do this for the entire office. It is uncertain how many and whom will end up using it. I'm hoping I can write a patch that will check for the calendar control and, if not found, register the file (on the network drive) and programmatically add it to the userform. I know how to use the Shell command to automatically run Regsvr32 and register the calendar control. I also know how to programmatically add a reference to the VBA Extensibility Library. However, I've been unsuccessful at programmatically adding the control to the userform. Hoping someone can help or suggest a better solution. Best regards, Greg |
Programmactically add calendar control to userform
I had a similar problem and solved it by ditching MSCal.ocx and use the
MonthView control. This is part of the Windows Common Controls and is always present. It has the same or better features. RBS "Greg Wilson" wrote in message ... Hi all, I'm trying to write a patch for a program of mine. The program uses Calendar Control 9.0 and is installed on a network drive. A copy of MSCal.OCX has been added to the same folder. The program is intended to be used by several people in the office. Unfortunately, apparently many don't have the calendar control file and/or don't have it registered. This causes an error message and causes the calendar control to disappear from the userform when the program is opened. I have successfully fixed the problem manually for one computer but it is impractical to do this for the entire office. It is uncertain how many and whom will end up using it. I'm hoping I can write a patch that will check for the calendar control and, if not found, register the file (on the network drive) and programmatically add it to the userform. I know how to use the Shell command to automatically run Regsvr32 and register the calendar control. I also know how to programmatically add a reference to the VBA Extensibility Library. However, I've been unsuccessful at programmatically adding the control to the userform. Hoping someone can help or suggest a better solution. Best regards, Greg |
Programmactically add calendar control to userform
Thanks for responding. That sounds like the ticket. I'll check it out.
Best regards, Greg "RB Smissaert" wrote: I had a similar problem and solved it by ditching MSCal.ocx and use the MonthView control. This is part of the Windows Common Controls and is always present. It has the same or better features. RBS "Greg Wilson" wrote in message ... Hi all, I'm trying to write a patch for a program of mine. The program uses Calendar Control 9.0 and is installed on a network drive. A copy of MSCal.OCX has been added to the same folder. The program is intended to be used by several people in the office. Unfortunately, apparently many don't have the calendar control file and/or don't have it registered. This causes an error message and causes the calendar control to disappear from the userform when the program is opened. I have successfully fixed the problem manually for one computer but it is impractical to do this for the entire office. It is uncertain how many and whom will end up using it. I'm hoping I can write a patch that will check for the calendar control and, if not found, register the file (on the network drive) and programmatically add it to the userform. I know how to use the Shell command to automatically run Regsvr32 and register the calendar control. I also know how to programmatically add a reference to the VBA Extensibility Library. However, I've been unsuccessful at programmatically adding the control to the userform. Hoping someone can help or suggest a better solution. Best regards, Greg |
Programmactically add calendar control to userform
RB Smissaert wrote
I had a similar problem and solved it by ditching MSCal.ocx and use the MonthView control. This is part of the Windows Common Controls and is always present. It has the same or better features. Where would that control be found? -- David |
Programmactically add calendar control to userform
RB Smissaert wrote
It is part of MSCOMCT2.OCX The control is called Microsoft MonthView Control. I have version 6.0 RBS "David" wrote in message ... RB Smissaert wrote I had a similar problem and solved it by ditching MSCal.ocx and use the MonthView control. This is part of the Windows Common Controls and is always present. It has the same or better features. Where would that control be found? -- David Thanks. I guess since this is an Excel programming group, my next question would be 'How do I make use of it in Excel?' -- David |
Programmactically add calendar control to userform
Make a userform, add the control to the available controls,
put it on the userform and add the code. The code will be very similar as that used with MSCal.ocx RBS "David" wrote in message ... RB Smissaert wrote It is part of MSCOMCT2.OCX The control is called Microsoft MonthView Control. I have version 6.0 RBS "David" wrote in message ... RB Smissaert wrote I had a similar problem and solved it by ditching MSCal.ocx and use the MonthView control. This is part of the Windows Common Controls and is always present. It has the same or better features. Where would that control be found? -- David Thanks. I guess since this is an Excel programming group, my next question would be 'How do I make use of it in Excel?' -- David |
Programmactically add calendar control to userform
RB Smissaert wrote
Make a userform, add the control to the available controls, put it on the userform and add the code. The code will be very similar as that used with MSCal.ocx RBS "David" wrote in message ... RB Smissaert wrote It is part of MSCOMCT2.OCX The control is called Microsoft MonthView Control. I have version 6.0 RBS "David" wrote in message ... RB Smissaert wrote I had a similar problem and solved it by ditching MSCal.ocx and use the MonthView control. This is part of the Windows Common Controls and is always present. It has the same or better features. Where would that control be found? -- David Thanks. I guess since this is an Excel programming group, my next question would be 'How do I make use of it in Excel?' -- David Thanks. -- David |
All times are GMT +1. The time now is 01:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com