Reputation: 573
I want to save the csv file using the value of the variable in TCOM.
Here is how i save it using a hard coded value test1.csv, which works fine.
$workbook SaveAs {c:\test\test1.csv} $XlFileFormat(xlCSV)
But when i want to save it with the value of a variable which is similar to
$workbook SaveAs {c:\test\$testname.csv} $XlFileFormat(xlCSV)
I get error or i just get the file named $testname.csv, but not the value of the variable. How to do this.? I even tried ${testname}, this doesnt work.
Upvotes: 2
Views: 175
Reputation: 5365
Try this
$workbook SaveAs "c:\test\${testname.csv}" $XlFileFormat(xlCSV)
Upvotes: 0
Reputation: 3878
Enclosing somethnig in braces means nearly no substitutions are performed. Remove the braces and do something like $workbook SaveAs "C:/test/$testname.csv" $XlFileFormat(xlCSV)
Upvotes: 4