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 :

  1. copy chartobject present in worksheet
  2. goto powerpoint slide
  3. click pastespecial & select "use destination theme & embed workbook (h)".
  4. 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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -