vba - How to add a picture to a powerpoint slide from excel [Solved] -


so have set macro saves charts excel spreadsheet pictures (as part of larger procedure), , need code paste these pictures, 1 per slide, slideshow.

currently, have opened powerpoint presentation 4 blank slides, , have not managed import 1 picture.

i have been using methods shape.addpicture("c:\users\restofpathname"), have not managed them work

can help? thanks, btubnfj

edit : solved following code :

dim applpp powerpoint.application, prsntpp powerpoint.presentation, titlepage powerpoint.slide  set applpp = new powerpoint.application applpp.visible = true set prsntpp = applpp.presentations.add set titlepage = prsntpp.slides.add(index:=1, layout:=pplayouttitle) prsntpp.saveas ("c:\users\...")      dim oslide powerpoint.slide     dim opicture powerpoint.shape      set oslide = prsntpp.slides(1)      set opicture = oslide.shapes.addpicture("c:\users\public\pictures\sample pictures\penguins.jpg", _         msofalse, msotrue, 1, 2, 3, 4)      opicture.scaleheight 0.9, msotrue     opicture.scalewidth 0.9, msotrue      prsntpp.pagesetup         opicture.left = (.slidewidth \ 2) - (opicture.width \ 2)         opicture.top = (.slideheight \ 2) - (opicture.height \ 2)     end 

here code allowed me put picture in powerpoint, excel. code below works, , this link useful

dim applpp powerpoint.application, prsntpp powerpoint.presentation, titlepage powerpoint.slide      set applpp = new powerpoint.application     applpp.visible = true     set prsntpp = applpp.presentations.add     set titlepage = prsntpp.slides.add(index:=1, layout:=pplayouttitle)     prsntpp.saveas ("c:\users\...")          dim oslide powerpoint.slide         dim opicture powerpoint.shape          set oslide = prsntpp.slides(1)          set opicture = oslide.shapes.addpicture("c:\users\public\pictures\sample pictures\penguins.jpg", _             msofalse, msotrue, 1, 2, 3, 4)          opicture.scaleheight 0.9, msotrue         opicture.scalewidth 0.9, msotrue          prsntpp.pagesetup             opicture.left = (.slidewidth \ 2) - (opicture.width \ 2)             opicture.top = (.slideheight \ 2) - (opicture.height \ 2)         end 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -