Embed MS Excel into VB form


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Embed MS Excel into VB form

  1. #1
    David N. Guest

    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.



  2. #2
    Arthur Wood Guest

    Re: Embed MS Excel into VB form


    David,
    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
    Application object

    3)
    set m_Excel = CreateObject(,"Excel.Application")
    which will actually instantiate the Excel application object from your
    VB aplication.

    From there, you will be able to work in code with all of the exposed Excel
    functionality (worksheets, cells, etc).

    Arthur Wood



    "David N." <davidng@magma.ca> 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.
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center