This content has been marked as final. Show 4 replies
I need help to save excel with Current Selection as file name. Also if there is nothing selected, it should save as default name
I tried to setup a variable which will hold current selection value and use it in the macro but it doesn't work.
Varialbe declared in Document Properties as:
vSelection = (replace(GetCurrentSelections(),': ','_')
and Macro is:
set v = ActiveDocument.Variables("vSelection")
Selection = v.GetContent.String
Path = "C:\qlikview\"
FileName = Selection & "_Report" & ".xlsx"
objExcelWorkbook.SaveAs Path & FileName
MsgBox("File Saved Successfully in C:\qlikview\"+Selection+".xls")
It works for a single fiield is selected. If I have more than one Field selected, it doesn't work because vSelection sends string in two lines