ADODB Connection in Same Excel File

A

Abhishake

Hi All,
I m using Excel 10.0 (Office XP SP3).

The scenario out with me is that a Visual Basic Exe Generates an Excel File.
This Excel file (Will refer this Final Report further).
This final report will we used by the End User. Know this final report
contains a Sheet (let suppose “Sheet1†will be hidden sheet) this sheet
contains Data in a Simple Table format (like a Sql Server has). As this is a
stand alone file, that will contains macros and some buttons to initiate the
macro in the Visual Basic Editor, for all other process. I want to open a
connection within the same Excel file. Then the records can be fetched by
using recordset for various calculations like (percentage, average)

I can’t use the Excel formula in this process

I have used the following code for opening a connection where
strDBPath =†C:\DATA\Automation\Excel Tool\Test.xlsâ€

Sub OpenExcelDatabase(strDBPath As String)
Dim cnnDB As New ADODB.Connection

With cnnDB
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Extended Properties") = "Excel 8.0"
.Open strDBPath
End With
End Sub

This Code used some other Excel file (Test.xls). But over here my
requirement is to open the connection with same Excel file with a Different
Sheet (“Sheet1â€)

Please any one can tell me what I need to pass while opening the Connection
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top