p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB How-To (http://p2p.wrox.com/forumdisplay.php?f=78)
-   -   create excel file without excel.exe (http://p2p.wrox.com/showthread.php?t=79449)

ackid32 May 18th, 2010 03:03 AM

create excel file without excel.exe
 
Hello,

I want to create an excel file from all the data gathered in my application. The problem I have is that Excel is not installed on my PC so creating the xls file by means of communicating with Excel.exe (OLE, ActiveX, ...) is not an option.


Installing Excel on the PC also isn't an option since the PC's are used inside a production environment and installing Excel on every PC would simply cost too much.

So, in short, I'm looking for code/examples/dll's/third party toolkits that allow me to create an excel xls file from within my application.


Thanks in advance for all the help!

vb5prgrmr May 18th, 2010 03:21 AM

While I am pretty sure that you cannot create a native xls format file without having excel, at least you can do it easily, you can create a csv (Comma Seperated Values) file that excel can read easily. However, if you must have the native format, see http://www.wotsit.org/list.asp?search=xls



Good Luck

ackid32 May 18th, 2010 06:10 AM

but some dlls are there?
 
if im using excel on some machines an error
"Class does not support automation or does not support expected interface" - Error No.430 came.
is there any remedy
i heard that some dll-s are available. i've googled, but nothing found. hope i get a solution here [;)]

vb5prgrmr May 18th, 2010 09:30 AM

That sounds more like a problem between versions of excel but without seeing the code that causes the problem I can only guess...



Good Luck

ackid32 May 19th, 2010 02:40 AM

code
 
here it is

dim xx as new excel.application
dim yy as new excel.workbook

set yy=xx.workbooks.add in this line the error occurs

in my reference i add excel.exe

the problem is that this code work fine on my one system and not in the other (i installed office xp on both systems with same configurations)

could u find the solution?

thanks

vb5prgrmr May 19th, 2010 02:49 AM

Okay,... on your machine, design it as you have but before you compile it, change your code to use CreateObject (see your friends, yahoo, google, ask, answers, bing for "vb6 createobject excel application"). It is a simple enough change to make and also you will have to remove the reference to excel before you compile. Also, add error trapping to catch the error if it is unable to create the excel application object. If that is successful then pretty much everything else should be successful unless you have used something that is not a part of a previous version of excel and the machine your program is on has that previous version.



Good Luck

Shasur May 20th, 2010 07:44 AM

As vb5prgrmr has said, CSV files are the best option. You can save the CSV file as ".XLS". When the user opens it he needs to save a copy in Native Excel format

The best option would be to go for OpenXML and create Excel (.xlsx) file as an XML file through code

Cheers
Shasur

ackid32 May 21st, 2010 12:13 AM

Hi
 
Quote:

Originally Posted by vb5prgrmr (Post 258075)
Okay,... on your machine, design it as you have but before you compile it, change your code to use CreateObject (see your friends, yahoo, google, ask, answers, bing for "vb6 createobject excel application"). It is a simple enough change to make and also you will have to remove the reference to excel before you compile. Also, add error trapping to catch the error if it is unable to create the excel application object. If that is successful then pretty much everything else should be successful unless you have used something that is not a part of a previous version of excel and the machine your program is on has that previous version.



Good Luck

I used the createobject method also but the result is same.
the error is '
"class does not support automation or does not support expected interface"
Error No-430

the same error with both type of codes
can u figure it out

ackid32 May 21st, 2010 12:15 AM

multiple sheet
 
Quote:

Originally Posted by Shasur (Post 258135)
As vb5prgrmr has said, CSV files are the best option. You can save the CSV file as ".XLS". When the user opens it he needs to save a copy in Native Excel format

The best option would be to go for OpenXML and create Excel (.xlsx) file as an XML file through code

Cheers
Shasur

is it possible to create CSV file with multiple sheets

Shasur May 21st, 2010 03:51 AM

Quote:

Originally Posted by ackid32 (Post 258162)
is it possible to create CSV file with multiple sheets

Unfortunately you can't CSV is for a sheet alone


All times are GMT -4. The time now is 06:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.