PP_ScreenShot.jpg
See image above. The panel I'm referring to is on the left, showing each slide in the presenation numbered from 1 thru x (in this case 1 thru 8). In the code below, the first section deletes all objects on slide 7 (refer to the left panel in the image). Here I have to actually refer to it as slide 7 (which makes sense). However, in the code following this, I replace all the objects I deleted. (there may be an easier way to do this, but I'll get to that later). In this section you will see that I have to refer to it as "Slide2" (this makes NO sense).
'Begin Slide 2************************************** 'Delete all objects on slide 2 (slide7) With Application.ActivePresentation.Slides(7).Shapes For intShape2 = .Count To 1 Step -1 .Item(intShape2).Delete Next End With 'Textbox Caption - Current Time Slide2.Shapes.AddTextbox(msoTextOrientationHorizontal, Left:=30, Top:=50, _ Width:=660, Height:=100).TextFrame.TextRange.Text = "Current Time" With Slide2.Shapes(1).TextFrame.TextRange.Characters .Font.Name = "Ariel" .Font.Size = 96 .Font.Bold = True .Font.Italic = True .Font.Color.RGB = RGB(122, 131, 160) End With Slide2.Shapes(1).TextEffect.Alignment = msoTextEffectAlignmentCentered
There are 4 other objects that are deleted and re-added but you get the idea.
Now as for the better option, the only way I could figure to change the text or value of an object was to delete it and recreate it each time. The reason I deleted all objects on the slide is because they are numbered sequencially in the order they are read. If I deleted an object from the middle (say Slide2.Shape(3)) the objects would get re-numbered and create all kinds of havoc.
Now with that said, is there a way I can assign a new value to an object without deleting and recreating it?
I hope this makes sense because it is very confusing to me.
Thanks for your help.
Mike




Reply With Quote