CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2000
    Posts
    292

    Opening an Access Table through Excel in a Form

    Hi.

    I have a form where I want to display an Access table through Excel. I need to make formulas and computations as part of data analysis and since Excel has a lot of mathematical capabilities, it was chosen to be used. My problems are the following:

    1) How can I call Excel from within VB?
    2) How can I display a single particular table of an Access .MDB file in the VB form?

    What reference/components will I add to my VB app? I know that I have to use OLE or something to link different apps. But how can I accomplish the above questions to start with? Thanks fo the info in advance!


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Opening an Access Table through Excel in a Form

    1) How can I call Excel from within VB?

    Dim ApExcel As Object 'To open Excel

    Set ApExcel = CreateObject("Excel.application") 'Creates an object
    ApExcel.Visible = True ' So you can see Excel
    ApExcel.Workbooks.Add 'Adds a new book.
    ApExcel.cells(1, 1).Formula = "HELLO" 'Add Text to a Cell
    'You can use the line above, changing coordenates to go to any
    'cell and you can also add Formulas
    ApExcel.Range("A1:Z1").BORDERS.Color = RGB(0, 0, 0) 'Use it to
    'change the borders.

    2) How can I display a single particular table of an Access .MDB file in the VB form?

    add ado data grid control and databound grid. Bind it to the desired table

    What reference/components will I add to my VB app? I know that I have to use OLE or something to link different apps. But how can I accomplish the above questions to start with? Thanks fo the info in advance!

    references:
    Excel library
    Access library
    if you wil use ADO then ADO library


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Mar 2000
    Posts
    292

    Re: Opening an Access Table through Excel in a Form

    Thank you for the reply. But for my second question, I need to display the Access table on the object created from Excel. I mean, I have a form, & in this form, I need to display an Excel worksheet, which in turn displays a table from Access. How can I select a single particular table to display from a set of tables in the same Access file? The DBGrid cannot handle calculations, so I'm employing Excel to support my calculations & formulas. Any suggestions?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured