Hello Ben,
Here is the second part of adding and OLE control to the UserForm, creating an event procedure from code. For this to work, you will have to add a reference to the VB Extensibility library.
In the VBA editor, go to the "Tools" menu, choose the "References" item, and put a check next to "Microsoft Visual Basic For Applications Extensibility" library. This enables VBA to find the definitions of these objects. If you are using Excel 2000 or later, it will appear with a version number: "Microsoft Visual Basic For Applications Extensibility 5.3". It is very important that you reference the proper library. If you reference the wrong library, you will receive "Type Mismatch" errors. If you don't reference the extensibility library at all, you will receive "User Defined Type Not Defined Error" messages. Click the OK button to load the library.
A few points about formatting the code that is inserted into the code procedure. It must be a String. If an argument has quotes, like "This is a string." you must use double quotes to enclose it, like this...""This is a string."" A line ends with a Carriage Return Line Feed character, vbCrLf. This is all shown in the code sample above.
Sincerely,
Leith Ross
Bookmarks