Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macrosss

Hi

PFa


Labels (1)
1 Reply
Not applicable
Author

 

sub ExportExcel()

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = true

Set xlDoc = xlApp.Workbooks.Add()
filePath = "D:\qv\export.csv"
'Create the new sheet and the content in the sheet
Set xlSheet = xlDoc.Worksheets.Add
xlSheet.Name = "SheetFromExcel"


xlSheet.Range("A1").Value = "DataHeader"&getVariable("vTodayDate1")&" N *"
xlSheet.Range("A1").EntireColumn.ColumnWidth = 36
xlSheet.Range("A2").Value = "*AppHeader"&getVariable("vTodayDate")&" Test@test.com"


Set SheetObj = ActiveDocument.GetSheetObject("myChart")
SheetObj.CopyTableToClipboard true
xlSheet.Paste xlSheet.Range("B3")

xlSheet.Range("A"&getVariable("vCount")+4).Value = "* end trailer abcdef "&getVariable("vCount")

xlSheet.Range("A"&getVariable("vCount")+5).Value = "End Test"

xlSheet.SaveAs filePath
xlApp.Quit
End sub


function getVariable(varName)
set v = ActiveDocument.Variables(varName)
getVariable = v.GetContent.String
end function