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

Tip/Technique - Using Macros in Excel with SmartAssembly

Highlighted
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