Embed an Excel Worksheet in VBA form

Started by nessim, October 02, 2008, 01:23:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nessim

Hi guys,

I really searched and tried a lot in order to solve the following problem but did not find a satisfying solution:

The project I am currently working on is a form that should help designing complex shape structures for UI prototyping. In this case it is a "Table Wizard" that lets the user configure the appearance of a table and then generate the corresponding shapes on a page. So far, I used an "Office Web Component (OWC) Spreadsheet" that allows typing in the table cell values and other attributes (Screenshot attached). Everything works fine with this configuration. The problem with OWC is that it is no longer part of Office 2007 and therefore not really an option as most of the endusers will be using Office07. Furthermore, it always triggers an "ActiveX Component" security warning popup when I load the Visio file (it would be OK to click it once if the user actually opens the "TableWizard" form itself).

My idea was to replace OWC with an Excel Spreadsheet object that should be generated and embedded into the form during runtime (that should guarantee version independency) . Unfortunately, there is no such thing as an OLE container object in VBA. I tried a detour using the Web Browser Object as container and then load an Excel file but that is very inconvenient and unstable.
Adding the spreadsheet in design mode is not possible either as there is no object like "Microsoft Office Excel Spreadsheet" (or whatever) available in my "Additional Controls..." toolbox ( I have a reference to "Microsoft Excel 11.0 Object Library").

To sum it up: I'd like to create an Excel (Worksheet) object programatically and then insert it into a form or container of any kind in VBA.

I would very much appreciate any idea!

Thanks in advance,
Nessim

I attached a screenshot to show what I'm up to. This is my prototype using an OWC spreadsheet.