If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Specifying a slide range
How can I specify a range of slides without listing each slide in the desired
range? For example the following works to specify slides 1 through 5: For Each objSlide In ActivePresentation.Slides.Range(Array(1, 2, 3, 4, 5)) However, sometimes the desired range will include 50 or more slides, and listing them individually seems silly and time consuming... Therefore I'd like to write something like the following (which doesn't work): For Each objSlide In ActivePresentation.Slides.Range(Array(1 To 5)) |
#2
|
|||
|
|||
Specifying a slide range
See: http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx
-- Thanks, Glenna Shaw Microsoft PowerPoint MVP Team http://www.pptmagic.com "Lisa" wrote: How can I specify a range of slides without listing each slide in the desired range? For example the following works to specify slides 1 through 5: For Each objSlide In ActivePresentation.Slides.Range(Array(1, 2, 3, 4, 5)) However, sometimes the desired range will include 50 or more slides, and listing them individually seems silly and time consuming... Therefore I'd like to write something like the following (which doesn't work): For Each objSlide In ActivePresentation.Slides.Range(Array(1 To 5)) |
#3
|
|||
|
|||
Specifying a slide range
Thank you for your response, Glenna. I've reviewed the info at the link
below, and do not see anything that points me to how I can specify the range without listing all the individual slides within the range. As far as I can tell, the examples given in the article are analogous to: ActivePresentation.Slides.Range(Array(1, 2, 3, 4, 5)) (Slides listed individually either by index or name) What I'm hoping to do is something analogous to: ActivePresentation.Slides.Range(Array(1 To 5)) (Slide range defined with a beginning and end of the range, inclusive of all slides between beginning and end) Am I missing something in the article? Thanks again, LM "PPTMagician" wrote: See: http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx -- Thanks, Glenna Shaw Microsoft PowerPoint MVP Team http://www.pptmagic.com "Lisa" wrote: How can I specify a range of slides without listing each slide in the desired range? For example the following works to specify slides 1 through 5: For Each objSlide In ActivePresentation.Slides.Range(Array(1, 2, 3, 4, 5)) However, sometimes the desired range will include 50 or more slides, and listing them individually seems silly and time consuming... Therefore I'd like to write something like the following (which doesn't work): For Each objSlide In ActivePresentation.Slides.Range(Array(1 To 5)) |
#4
|
|||
|
|||
Specifying a slide range
In article , Lisa wrote:
How can I specify a range of slides without listing each slide in the desired range? For example the following works to specify slides 1 through 5: For Each objSlide In ActivePresentation.Slides.Range(Array(1, 2, 3, 4, 5)) However, sometimes the desired range will include 50 or more slides, and listing them individually seems silly and time consuming... Therefore I'd like to write something like the following (which doesn't work): For Each objSlide In ActivePresentation.Slides.Range(Array(1 To 5)) It'll depend on what you want to do but if the range is contiguous: Dim x As Long For x = 1 to 50 With ActivePresentation.Slides(x) Debug.Print .Name ' or do whatever else you want End With Next ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
#5
|
|||
|
|||
Specifying a slide range
Lisa,
If the slide range is going to be sequential you can simple loop thru the slide from the starting slide to the last slide. For I = 10 to 60 Debug.Print Activepresentation.slides(I).Name Next The Range method is extremely handy when you want to work with non contiguous slides based on an array selection. But you need to populate the array with values. Dim MyArr(1 to 3) as Long Dim oSld as Slide MyArr(1)=12 MyArr(2)=22 MyArr(3)=32 For Each oSld In ActivePresentation.Slides.Range(MyArr) Debug.Print oSld.Name Next -- Regards, Shyam Pillai Image Importer Wizard http://skp.mvps.org/iiw.htm "Lisa" wrote in message ... How can I specify a range of slides without listing each slide in the desired range? For example the following works to specify slides 1 through 5: For Each objSlide In ActivePresentation.Slides.Range(Array(1, 2, 3, 4, 5)) However, sometimes the desired range will include 50 or more slides, and listing them individually seems silly and time consuming... Therefore I'd like to write something like the following (which doesn't work): For Each objSlide In ActivePresentation.Slides.Range(Array(1 To 5)) |
#6
|
|||
|
|||
Specifying a slide range
Steve and Shyam, thank you both very much -- your guidance helped immensely!
Just in case it's of any use to anybody, below is the code that incorporates the infor you gave me. It formats text boxes that say "UPDATE REQUIRED" that are on plopped onto the notes pages in an existing file, changing only those that are found on the notes pages for slides 3 to 22. A quirky little need -- but variations on the "do it for these contiguous slides" theme will help me with a bunch of other stuff. Thanks again! LM Sub FormatUpdateTxt Dim objShape As Shape Dim nn As Integer For nn = 3 To 22 For Each objShape In ActivePresentation.Slides(nn).NotesPage.Shapes If objShape.TextFrame.HasText Then If objShape.TextFrame.TextRange.Text = "UPDATE REQUIRED" Then With objShape.Fill .Solid .ForeColor.RGB = RGB(0, 0, 255) End With Else 'do nothing End If Else 'do nothing End If Next Next End Sub "Shyam Pillai" wrote: Lisa, If the slide range is going to be sequential you can simple loop thru the slide from the starting slide to the last slide. For I = 10 to 60 Debug.Print Activepresentation.slides(I).Name Next The Range method is extremely handy when you want to work with non contiguous slides based on an array selection. But you need to populate the array with values. Dim MyArr(1 to 3) as Long Dim oSld as Slide MyArr(1)=12 MyArr(2)=22 MyArr(3)=32 For Each oSld In ActivePresentation.Slides.Range(MyArr) Debug.Print oSld.Name Next -- Regards, Shyam Pillai Image Importer Wizard http://skp.mvps.org/iiw.htm "Lisa" wrote in message ... How can I specify a range of slides without listing each slide in the desired range? For example the following works to specify slides 1 through 5: For Each objSlide In ActivePresentation.Slides.Range(Array(1, 2, 3, 4, 5)) However, sometimes the desired range will include 50 or more slides, and listing them individually seems silly and time consuming... Therefore I'd like to write something like the following (which doesn't work): For Each objSlide In ActivePresentation.Slides.Range(Array(1 To 5)) |
#7
|
|||
|
|||
Specifying a slide range
Glad it helped, and thank *you* for posting back your example code.
In article , Lisa wrote: Steve and Shyam, thank you both very much -- your guidance helped immensely! Just in case it's of any use to anybody, below is the code that incorporates the infor you gave me. It formats text boxes that say "UPDATE REQUIRED" that are on plopped onto the notes pages in an existing file, changing only those that are found on the notes pages for slides 3 to 22. A quirky little need -- but variations on the "do it for these contiguous slides" theme will help me with a bunch of other stuff. Thanks again! LM Sub FormatUpdateTxt Dim objShape As Shape Dim nn As Integer For nn = 3 To 22 For Each objShape In ActivePresentation.Slides(nn).NotesPage.Shapes If objShape.TextFrame.HasText Then If objShape.TextFrame.TextRange.Text = "UPDATE REQUIRED" Then With objShape.Fill .Solid .ForeColor.RGB = RGB(0, 0, 255) End With Else 'do nothing End If Else 'do nothing End If Next Next End Sub "Shyam Pillai" wrote: Lisa, If the slide range is going to be sequential you can simple loop thru the slide from the starting slide to the last slide. For I = 10 to 60 Debug.Print Activepresentation.slides(I).Name Next The Range method is extremely handy when you want to work with non contiguous slides based on an array selection. But you need to populate the array with values. Dim MyArr(1 to 3) as Long Dim oSld as Slide MyArr(1)=12 MyArr(2)=22 MyArr(3)=32 For Each oSld In ActivePresentation.Slides.Range(MyArr) Debug.Print oSld.Name Next -- Regards, Shyam Pillai Image Importer Wizard http://skp.mvps.org/iiw.htm "Lisa" wrote in message ... How can I specify a range of slides without listing each slide in the desired range? For example the following works to specify slides 1 through 5: For Each objSlide In ActivePresentation.Slides.Range(Array(1, 2, 3, 4, 5)) However, sometimes the desired range will include 50 or more slides, and listing them individually seems silly and time consuming... Therefore I'd like to write something like the following (which doesn't work): For Each objSlide In ActivePresentation.Slides.Range(Array(1 To 5)) ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ |
Thread Tools | |
Display Modes | |
|
|