Click to See Complete Forum and Search --> : Opening an Access Table through Excel in a Form


daneb
March 25th, 2001, 08:48 PM
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!

Iouri
March 25th, 2001, 09:30 PM
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
iouri@hotsheet.com

daneb
March 26th, 2001, 12:05 AM
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?