[dba-Tech] would an array be best for this?

Stuart McLachlan stuart at lexacorp.com.pg
Wed Feb 9 01:11:56 CST 2005


On 9 Feb 2005 at 0:34, John Bartow wrote:
>  
> My problem is that I need to have a method which allows the user to enter
> which pages shouldn't be converted to grayscale and then prevent my little
> routine here from messing with those slides. There is one small section in
> the PP-VBA module below, enclosed in
> '--------------------------------------------- where you will be able to see
> what I mean. I have eliminated one slide from being processed by the
> statement: "If objSlide.SlideNumber <> 9 Then"

Try something like this (assumes that PP VBA has Inputbox, Split and Join 
functions)

> Sub ProcessShapes()
> Dim objSlide As Slide
> Dim objShape As Shape
> Dim i As Integer
> Dim intUseGray As Integer
> Dim lngNewRGB As Long
>  
Dim strPages() as string
Dim StrSkipPages as String
Dim lngLoop as Long
'Get user input
strSkipPages = Inputbox("Enter pages to skip, separated by commas")

'use split and join to change format of each element to three digits 
' so that 9 won't be skipped 'if 19 if in the list etc

'build array
strPages() = split(strSkipPages,",")
'pad elements 
For lngLoop = 0 to Ubound(strPages())
    strPages(lngLoop) = Right$("000" & strPages(lngLoop),3)
Next
'Rebuild String
strSkipPages = Join(strPages(),",")

 For Each objSlide In ActivePresentation.Slides
     intCountObjects = intCountObjects + 1 'running count of objects

'test whether we should process this slide
      If  Instr(strSKipPages,Format$(intCountObjects,"000")) > 1 then 
         For Each objShape In objSlide.Shapes
              ..........
        Next objShape
    End if  

 Next objSlide

-- 
Stuart





More information about the dba-Tech mailing list