excel - Use Destination Theme & Embed Workbook (h) -
i trying copy chartobject created in workbook sheet , paste powerpoint 2010 slide, such becomes standalone excel chart data (embedded).
when manually i.e :
- copy chartobject present in worksheet
- goto powerpoint slide
- click pastespecial & select "use destination theme & embed workbook (h)".
- right-click chartobject in powerpoint & click "edit data".
then new standalone workbook title "chart in microsoft excel", shows chart data. have not been able replicate scenario new standalone workbook title "chart in microsoft excel" using excel vba. can help?
assuming there simple column chart on sheet, here code:
option explicit sub doit() dim temp workbook dim rng range dim chtobj chartobject thisworkbook.sheets(1) set chtobj = .chartobjects(1) chtobj .copy end dim ppapp object dim pppres object dim ppslide object on error resume next set ppapp = getobject(, "powerpoint.application") if ppapp nothing set ppapp = createobject("powerpoint.application") end if on error goto 0 set pppres = ppapp.presentations.add set ppslide = pppres.slides.add(1, 12) ppapp .activate .visible = msotrue .activewindow.viewtype = 1 end chtobj.copy ppapp.activewindow.view.paste end end sub
there appears no corresponding method in powerpoint object model.. way call ribbon button itself:
application.commandbars.executemso("pasteexcelchartdestinationtheme")
btw: find list of ribbon buttons, search "office 2010 control ids".
Comments
Post a Comment