0
votes

How will i be able to read an excel file in vb6 when i do not have Microsoft Excel Installed on the Server. I am trying to Add Reference of "Microsoft Excel 12.0 Object Library" but i cannot see the object to add in the reference. What files or dll file should i have to download to make it work.

Dim xl As Excel.Application
Dim xlwBook As New Excel.Workbook
Dim xlSheet As New Excel.WorkSheet`

And Can i use this application when i do not have Excel installed on my system?

Any Help Will Be Appreciated.

2
Pop up a cmd prompt, type odbcad32. The ones you can use are under the Drivers tab. You can use the jet engine or ACE OLE DB as well but you may need to install the accessdatabaseengine.exe from microsoft.cup
i already have access database engine installed. and i can see Microsoft Excel Driver in the ODBC Administrator. but when i am trying to add that in the reference it says "can't add reference". what am i doing is correct??KloppForKop
support.microsoft.com/en-us/kb/195951 This is an article that details the steps to read an excel file as if it's a database. It needs to be in a table format.user6017774

2 Answers

1
votes

I am using "Microsoft Excel 14.0 Object Library" (Office 2010) and it points straight to the Excel.exe

VB6 References

Office 2007+ favors .net but for vb6 i think you can make it work by installing Office Primary Interop Assemblies

And you may need to use create object instead. Like,

Public objExcel As Object 'instead of Excel.Application
Set objExcel = CreateObject("Excel.Application")
1
votes

If you don't have Excel installed you cannot use its COM Model (Excel.Application) or the PIAs mentioned elsewhere (which would be of no use even if you did have Excel installed).

You should do this using ODBC & ADO.

and i can see Microsoft Excel Driver in the ODBC Administrator .. but when i am trying to add that in the reference it says "can't add reference"

You don't reference the driver, you would reference ADO (Microsoft ActiveX Data Objects) specifying the driver by name in the connection string.

There are many examples of this, E.g. https://support.microsoft.com/en-us/kb/278973