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.
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
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
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, TrueIt 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