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

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

chart 'send to excel' with button object

Hello,

  I want to mimic the functionality of the 'send to excel'  (in the caption of charts) with a button.  Is this possible? 

Thanks,

Tyler

8 Replies
Not applicable
Author

If it is of any importance this will also be done using the ajax client

Not applicable
Author

Hi Tyler ,

try this macro

Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open("C:\Folder\Document.xls")
objExcel.Visible = True

Thanks

Meher

Not applicable
Author

I ran this macro and I get the error: ActiveX component can't create object: 'Excel.Application'

I also do not see how this macro would know what chart I am wanting to send to excel, wouldn't I need to specify the chart ID somewhere?

Not applicable
Author

If the above one didn't worked for you try this

sub export_summary

set v = ActiveDocument.Variables("QvWorkPath")

set XLApp = CreateObject("Excel.Application")
XLApp.Visible = false
set ExcelDoc = XLApp.Workbooks.Add

ExcelDoc.Sheets(1).activate

set obj1 = ActiveDocument.getsheetobject("CH_Cases")
obj1.CopyTableToClipboard true
ExcelDoc.Sheets(1).cells(1,1).select
ExcelDoc.Sheets(1).paste
ExcelDoc.Sheets(1).Rows("1:1").Font.Bold = True
set obj1 = nothing

"CH_Cases": replace it with your object ID

ExcelDoc.Sheets(1).cells(1,1).select: means that it will start in A1.

Thanks

Meher

Not applicable
Author

Thanks for the help Merwan, unfortunately I am still getting the same error.

on this line:

set XLApp = CreateObject("Excel.Application")

I get the error:

ActiveX component can't create object: 'Excel.Application'

Not applicable
Author

Tyler can you check that you Allow System Access for the macro in the Macro module . Otherwise you will not be allowed to create objects.

thanks

Meher

Not applicable
Author

Dim kost,i

    kost = ""

    kost = "Sheet1" 

   

    set XLApp = CreateObject("Excel.Application")

    XLApp.Visible = True

    set XLDoc = XLApp.Workbooks.Add

    set tbl = ActiveDocument.GetSheetObject("CH1053")

    set XLSheet = XLDoc.Worksheets(1)

    tbl.CopyTableToClipboard true

    XLSheet.Paste XLSheet.Range("A1")

    xlsheet.Range("A:A").WrapText = True

    XLsheet.Cells.Borders.LineStyle = 1

    ActiveDocument.GetApplication.WaitForIdle

    ActiveDocument.GetSheetObject("CH1054").CopyBitmapToClipboard

    XLDoc.Sheets(kost).Range("A" &  10).Select

    XLDoc.Sheets(kost).Paste

   

end sub

Not applicable
Author

EDIT: This seems to not work once its accessed through the AccessPoint with the Ajax client. It does work with the IE plugin though and in the developer.

I commented out the last 4 lines because I don't need any images right now; but this works great, thanks!

    'ActiveDocument.GetApplication.WaitForIdle

    'ActiveDocument.GetSheetObject("CH1054").CopyBitmapToClipboard

    'XLDoc.Sheets(kost).Range("A" &  10).Select

    'XLDoc.Sheets(kost).Paste