×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to open Ansys APDL using Excel VBA

How to open Ansys APDL using Excel VBA

How to open Ansys APDL using Excel VBA

(OP)
Hello,

I am trying to create a macro in excel vba whose function is to open ansys apdl, read some files is sequence(/input) and generate the respective output files. I have already created macro for reading input in ansys but I am not able find the codes for opening ansys apdl through excel vba. Please help me in this regard.

Thank You.

RE: How to open Ansys APDL using Excel VBA

Hi there,

I've been making excel sheets with hundreds of runs for parametric models. Here's how I do it:
1, make a batch that executes your analysis (can be written by VBA)
2, run the batch from VBA

for point 1:
create a batch file (.bat) that runs ANSYS with parameters that will make it: run in batch, run in certain directory, execute in batch mode.
You can use The ANSYS Mechanical APDL Product Launcher to help to put the command together. Switch simulation environment to ANSYS Batch and in options choose Tools->Display Command Line

CODE --> batch

cd /D D:\temp"C:\Program Files\ANSYS Inc\v140\ansys\bin\winx64\ANSYS140.exe" -j job -b -p prfnls -dir "D:\temp\" -i input.txt -o output.log 

for point 2:
execute the batch file in Excel VBA

CODE --> VBA

Dim wsh As Object
    Set wsh = VBA.CreateObject("WScript.Shell")

    wsh.Run sWorkdir & strBatchFileName, 0, True 

It is possible to set it up in Excel such that the sheet does not freeze (or maybe it's already in the wsh.Run arguments).

I hope this helps.

Pavel

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources