Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
I'm trying to create a button that exports the charts that are active in a container.
I understand that you often can't call CT01 (for example you can't call it if you try to create a print button).
So far I have the code below:
sub launchXL
set oXL=CreateObject("Excel.Application")
oXL.visible=True
oXL.Workbooks.Add
'---------------------------------------
aSheetObj=Array("CH12")
'---------------------------------------
for i=0 to UBound(aSheetObj)
oXL.Sheets.Add
Set oSH = oXL.ActiveSheet
oSH.Range("A1").Select
Set obj = ActiveDocument.GetSheetObject(aSheetObj(i))
obj.CopyTableToClipboard True
oSH.Paste
sCaption=obj.GetCaption.Name.v
set obj=Nothing
oSH.Rows("1:1").Select
oXL.Selection.Font.Bold = True
oSH.Cells.Select
oXL.Selection.Columns.AutoFit
oSH.Range("A1").Select
oSH.Name=left(sCaption,30)
set oSH=Nothing
next
'---------------------------------------
set oXL=Nothing
end sub
Instead of CH12 in row 7 i would like to have CT01 but that doesn't work.
My thought was to detect what tab is active by using the ContProp.SingleObjectActiveIndex command and have a table that correlates that index to a chart. For example index 0 = CH01, index 1 = CH02 and so on.
My scipting skills are somewhat limited (understatement) and I cant manage to implement this in the script.
Am I on the right track here? Any help would be much appreciated.
Hi Daniel, were you able to solve this question of exporting active object residing in a container to Excel? If you did, can you please share your findings? I'm trying to implement the same concept in my script.