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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export to Excel in Macro instead of copy to clipboard

Hi everybody

I have doubt pls clarify me

I have an table and i want export that to excel sheet when I write a macro to export that its just copying my table to clipboard and its look like this

DateFundSector
25-06-2012Total
Zimb FundComm.
Cons
Cons. Non-Cycl.
Diver
Financial
Industrial
Materials
Greater FundComm.
GDF
Cons. Non-Cycl.
Diversified
Energy
Financial
Industrial
Materials
Kodun FundComm.
Cons. Cycl.
Cons. Non-Cycl.
Divers
Energy
Financial
Funds
Sports
Materials
Utilities

but when i export that manually its coming like this

DateFundSector
25-06-2013Zimb FundComm.
25-06-2014Zimb FundCons
25-06-2015Zimb FundCons. Non-Cycl.
25-06-2016Zimb FundDiver
25-06-2017Zimb FundFinancial
25-06-2018Zimb FundIndustrial
25-06-2019Zimb FundMaterials
25-06-2020Greater FundComm.
25-06-2021Greater FundGDF
25-06-2022Greater FundCons. Non-Cycl.
25-06-2023Greater FundDiversified
25-06-2024Greater FundEnergy
25-06-2025Greater FundFinancial
25-06-2026Greater FundIndustrial
25-06-2027Greater FundMaterials
25-06-2028Kodun FundComm.
25-06-2029Kodun FundCons. Cycl.
25-06-2030Kodun FundCons. Non-Cycl.
25-06-2031Kodun FundDivers
25-06-2032Kodun FundEnergy
25-06-2033Kodun FundFinancial
25-06-2034Kodun FundFunds
25-06-2035Kodun FundSports
25-06-2036Kodun FundMaterials
25-06-2037Kodun FundUtilities

I want this type of data when I use macros.please help with this.My macro script is

Sub Performance

     'Set the path where the excel will be saved  

     filePath = "D:\Baba\Performance.csv" 

 

     'Create the Excel spreadsheet  

     Set excelFile = CreateObject("Excel.Application") 

     excelFile.Visible = true 

     'Create the WorkBook 

     Set curWorkBook = excelFile.WorkBooks.Add 

     'Create the Sheet 

     Set curSheet = curWorkBook.WorkSheets(1) 

    

     'Get the chart we want to export 

     Set tableToExport = ActiveDocument.GetSheetObject("CH1893") 

     Set chartProperties = tableToExport.GetProperties 

     'tableToExport.CopyTableToClipboard true 

 

     'Get the caption 

     'chartCaption = tableToExport.GetCaption.Name.v 

     'MsgBox chartCaption 

 

     'Set the first cell with the caption 

     curSheet.Range("A1") = chartCaption 

     'Paste the rest of the chart 

     curSheet.Paste curSheet.Range("A1") 

     excelFile.Visible = true 

 

     'Save the file and quit excel 

     curWorkBook.SaveAs filePath 

     curWorkBook.Close 

     excelFile.Quit 

 

     'Cleanup 

     Set curWorkBook = nothing 

     Set excelFile = nothing 

End Sub  

0 Replies