Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macrosss

Hi

PFa


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