PDA

View Full Version : macro to sort slides based on shape value



jonofisher
08-01-2007, 01:49 PM
Hello

i am not bad on excel vba but this is my first time on powerpoint vba. i have reviewed the entire message board and have picked up some tips that might help, but now require some serious assistance (and hopepfulyl examples of code) to get started.

the situation: i would like to sort slides based on whether they have a certain shape at a certain position, and also based on matching the text in the shape to something. I will try and explain:
1. if slide has a shape (will refer to this as BOXA) at left 156, top 516.75 then send slide to back of presentation. Loop through all slides so we end up with all slides with BOXA on them at the back of the presentation
2. For each slide
a. if there is a BOX A (ie at 156,516.75) then get the text in BOX A (this will be a section number - ie 2.1 or 2.5)
b. loop through all slides and compare to the first characters (this is a section number - ie 2.1 or 2.5) of the box in position 156,78 (lets call this BoxB) (I am thinking you have to select text in BoxB, do a left function of amount of characters before the first space, and match on that)
i. if it?s the same, then take the slide number of the matched slide and put that slide number in BOX A (as text)
3. We will therefore end up with all the BOX A slides at the back, and in each BOXA will be the text of the page number which corresponds to the matched slide at the front end of the document
4. Finally sort all the Box A slides to make sure they are in correct order (numbers ascending) at the back of the document

for context, i am trying to get appendix type of slides to match to the slide number in the main part of a presentation. (ie only appendix slides have Box A on them). When writing a presentation we start off having these appendix slides in the main document, but then want to put them to the back and make sure they refer to the correct slide in the main doco
I would appreciate any thoughts on this or any pointers on how to get started. I very much appreciate any assistance - if this works it will automate something that i spend an inordinate and frustrating amount of time doing!

Cheers

JFish