Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
If it is of any importance this will also be done using the ajax client
Hi Tyler ,
try this macro
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open("C:\Folder\Document.xls")
objExcel.Visible = True
Thanks
Meher
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?
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
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'
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
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
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