cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

Tip/Technique - Using Macros in Excel with SmartAssembly

cfuller-2
1-Newbie

Tip/Technique - Using Macros in Excel with SmartAssembly


First you need to build the macro in the excel spreadsheet. If it is a simple macro, you can just record it (and call it with an empty array, but if you need to pass variables into it, you will need to do something like the example below.

 

Macro VB:

 

Sub create_csv(myfilepath As String, myfilename As String)

 

ThisWorkbook.SaveAs myfilepath & " & myfilename, _

 

FileFormat:=xlCSV, CreateBackup:=False

 

End Sub





PRINT "FIRST ARGUMENT FOR MACRO = %" TEMPSTRING

 

ADD_ARRAY_ELEM arrayArgumentsMacro TEMPSTRING



! create the filename value for the macro

 

TEMPSTRING = <new filename=" string=">+".csv"

 

PRINT "SECOND ARGUMENT FOR MACRO = % " TEMPSTRING

 

ADD_ARRAY_ELEM arrayArgumentsMacro TEMPSTRING




! call the macro


EXCEL_RUN_MACRO "create_csv" arrayArgumentsMacro

This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

0 REPLIES 0
Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags