View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
llowwelll[_6_] llowwelll[_6_] is offline
external usenet poster
 
Posts: 1
Default Add Controls With Events at Runtime

Okay, that did solve the problem for the code given above (and thank
again for the help). However, when I went to place this code into m
full application, I get the 'Microsoft Excel has encountered an erro
and needs to close' message. This apparently occurs right after th
code for the command button(s) is inserted programatically. When I ru
it, Excel moves focus to the VBE module for Sheet 1 with th
programatically generated code visible. It then hangs up and display
the error message.

Things I have considered as possible causes:
1) Protection...the workbook is not protected (BTW, could the workboo
be programatically unprotected just prior to running this code or mus
it be manually unprotected all of the time?)
2) References/Conflicts...I selected the same references for th
workbook that I used to test the above code as are selected in my ful
application and it ran fine. However, the full application crashes.
Those references a
a. Visual Basic for Applications
b. Microsoft Excel 9.0 Library
c. OLE Automation
d. Microsoft Office 9.0 Library
e. Microsoft Forms 2.0 Library
f. Microsoft Windows Common Controls 2 6.0 (SP4)
g. Microsoft ActiveX Data Objects (Multidimensional) 2.7 Library
h. Microsoft ActiveX Data Objects 2.5 Library
i. Microsoft Outlook 9.0 Library
j. Microsoft Visual Basic for Applications Extensibility 5.3
3) Open ADO Objects...I set all of the ADO objects to Nothing prior t
the commencement of the code in question
4) An integral part of my application is a procedure that invokes th
Application.OnTime function. This causes the database to be querie
every five minutes. I don't know if this could be the cause nor how t
work around it if it is.

Those are the issues that I considered. I have no idea if I'm barkin
up the wrong tree or not.

That's all I could think of and now I'm back to pulling my hair out.
Chip, or anyone else, I'd really appreciate some insight on this. I a
truly grateful for your help thus far and hope I'm not asking too muc
for just a little more.

Thanks again in advance!

--
Message posted from http://www.ExcelForum.com