• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

Writing an Excel file without opening Excel?

Can anyone tell me if there is a way to write or create an excel file without actually opening excel?

1 Solution
make a reference to MS Excel object library under project/references:

Dim xlApp as New Excel.Application
Dim xlWkBk as Excel.Workbook

set xlWkBk = xlApp.WorkBooks.add

'' do what you want w/ xlWkBk

xlWkBk.saveAs "<Path to xls>"
set xlWkBk = nothing

set xlApp = Nothing
Éric MoreauSenior .Net ConsultantCommented:
if you really don't want to open Excel, your best workaround is to generate a CSV file which is recognize natively by Excel
JasonNullWalAuthor Commented:
Could you please tell me more about how i would generate a CSV file.  One capability i would like the program to have is to create an excel file on a computer that does not have excel installed.  So that would rule out creating a reference to Excel since the library would not be available.  Is this possible with creating a CSV file?
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

CSV is good for text only.  Commas delimit information in the file ....


John Doe, 555-555-555, 55 Somewhere street
Jane Doe, 555-555-556, 66 Somewhere street

etc ....

Excel knows how to handle these files when they have a '.csv' extension.

To save something as a "true" native Excel file (with graphs, etc ....) without Excel will probably require a 3rd party tool and dll which will have to be installed with your application.  (Unless of course you want to write your own dll that can write to Excel format ..... which is what you're trying not to do).


JasonNullWalAuthor Commented:
I'm not using any graphs but i do have output being written to multiple sheets within the Excel project.  Right now the program writes to a text file if excel is not installed.
Éric MoreauSenior .Net ConsultantCommented:
Multiple sheets are not supported by CSV. It is only a text file. You definitely need to install Excel to do what you want.
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
Moderator, my recommended disposition is:

    Accept keenez's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now