vba - Programmatically create [Mail Merge] PowerPoint slides from Excel data -


using powerpoint 2010 mac.

i have 100-slide presentation needs created weekly. each slide has identical template. elements on each slide consist of 5 text fields , picture, each slide corresponding columns of data in excel table.

can point me code example or detailed walkthrough of how can loop through rows of excel file , programmatically create these slides?

this definately possible, , quite fun :-)

my first recommendation, create powerpoint template using master views, placeholders , titles ready go. run following powerpoint macro, can name , index/id every shape on page.

sub nameshapes()  dim sld slide dim shp shape set sld = application.activepresentation.slides(1)  each shp in sld.shapes     shp.texteffect.text = shp.name & " " & shp.id next end sub 

this quick , dirty piece of code puts index & name of each item on template page, shape itself. memorise, record these. these reference points want stuff go. i'm not going go on basics of looping etc, go on key code peices.

1) open , gain control of powerpoint excel.

set ppt = createobject("powerpoint.application") ppt.visible = true set myppt = ppt.presentations.add myppt.applytemplate ("your template here.potx") 

i add pages i'll need, (this can vary depending on application, , number of rows, , whether @ start, or in process, depend on whether have mapped page should put data onto, in data)

for x = 1 numberofpages     myppt.slides.addslide x, myppt.slidemaster.customlayouts(2) '2 index of template wish use (in master views, index order they're in (starting 1) next 

i'm assuming know page want update @ each row, so:

for each dr in .rows  'i'm storing data in special collection, need adapt     set currslide = myppt.slides(dr.cell("outputpage").value) 'go right page     sheets(dr.cell("sheetname").tostring).activate 'make sure data want active     activesheet.range(names(dr.cell("chartid").value)).copypicture 'copy table picture, easiest formatting in powerpoint, can lots of things here     currslide.select     currslide.shapes("content placeholder " & dr.cell("output position").tostring).select 'the output position index first bit of code,     ppt.activewindow.view.paste next 

now, application vary hope of basic necessities there, , should starting point.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -