Embed MS Excel into VB form
1. I am trying to embed MS Excel into VB form using EXCEL automation (ie,
dim m_excel as NEW EXCEL.Application)
2. Please show me how it could be done.
3. Thank you very much.
Re: Embed MS Excel into VB form
Are you trying to open an Excel spreadsheet actually shown ON YOUR form
or do you want to open Excel as a separate application, from within your
VB application. Your words say the former, but the code line you show says
the latter. If you want to open a spreadsheet actually in the form, then
you need to add an OLE (Object Linking and Embedding) control to you form,
and then the Wizard will allow you to make it an Excel Spreadsheet object
which you embed. The specific spreadsheet that is connected to the control
can be set either at design time, or at run time. When to form opens, Excel
will be running within the control, on the form. (This can maker your application
VERY large, as ALL OF EXCEL must by linked inside your executablw!!!). On
the other hand, if you want to run Excel from your application, :
1) add an reference to the Excel object library to your VB project (Project/References).
2) as you have done, dim a local variable to hold a pointer toi the Exccel
set m_Excel = CreateObject(,"Excel.Application")
which will actually instantiate the Excel application object from your
From there, you will be able to work in code with all of the exposed Excel
functionality (worksheets, cells, etc).
"David N." <firstname.lastname@example.org> wrote:
>1. I am trying to embed MS Excel into VB form using EXCEL automation (ie,
>dim m_excel as NEW EXCEL.Application)
>2. Please show me how it could be done.
>3. Thank you very much.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center