Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Excel via batch mode from another program

Status
Not open for further replies.

Stringmaker

Mechanical
Mar 18, 2005
513
Has anyone successfully done this? What I'd like to do is to call Excel from Ansys (my FEA program). I would need to read in values from a text file into excel and then export the output data from excel. I have envisioned doing this via macro but I would like to do this without opening the Excel GUI. Is this possible? I didn't see anything about batch mode in the Excel help.

Thanks in advance!
-Brian
 
Replies continue below

Recommended for you

Are you processing the data at all in Excel?

Why not just save as .CSV format?

TTFN



 
Yes I will be processing the data in Excel. I would like to have a workbook where I import the data from Ansys into say Column A of sheet 1. I will then run a macro within Excel that writes the desired output to a file that i need to read back into Ansys. Thanks!

-Brian
 
It sounds doable. Excel can be configured with a custom auto_open macro.

TTFN



 
IRstuff,
Interesting...how does one go about executing an auto_open macro?

Thanks for all of your help!
-Brian
 
It can also be done with Visual Basic.
 
An auto_open (or nowadays Workbook_Open event procedure) is associated with a workbook, so it will run when you open that workbook. You can call Excel with a workbook name (and path) as a parameter ("startup switch"), and Excel will open that when it starts.

Cheers,
Joerd

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
I've never run Excel from another application but I have used Excel to run other applications (usually old fortran excecutable programs or similar programs). Or simply used Excel to act as a "post processor" to programs that generate scads of data similar to fea.

For example, I used to use Excel to generate input files to the old FAST2 program (used as basis for Welding Research Council bulletin 207), then run FAST2 using the "Shell" command. Then take the output file(s) and perform further processing for stresses and condensed/summarized reports. Nowadays my work doesn't call for this so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor