From: David Marcovitz on
On 5/3/10 12:44 PM, broro183 wrote:
> hi all,
>
> *a1k1do*,
> Thanks for the feedback - I'm pleased I could help :)
>
> *David*,
> I'm new to ppt VBA coding*, as you may have guessed from my "CurSlide
> -1" instead of ".previous" - thanks, I'll remember that for the future
> :)
> *(I'm more experienced in Excel's VBA)
> I agree that the If statement is conceptually easier, esp in comparison
> to "flipping a select Case statement on its head" like I did. I think I
> did it that way because the concept was on my mind as I'd just been
> looking at some similar Excel VBA code.
>
> Just out of curiosity,
> In Excel's VBA I'll try to group anything I can using a With statement,
> but I notice that you haven't grouped anything. Is this just your
> personal preference or are there some limitations to With statements in
> PPT's VBA?
>
> Thanks
> Rob
>
>

Personal preference. I group things with With statements when they make
sense to me to do so. Too many With statements can get confusing. My
book about PowerPoint VBA is geared toward a non-programmer audience so
I usually aim for the conceptually easy even if it requires a few extra
lines of code. If figure once someone moves beyond my book, they will
develop their own coding style and learn all kinds of fun shortcuts. I
do discuss With in the book but don't use it a lot. Additionally, for my
previous answer, I was shooting from the hip and just typing what came
to mind.

As for CurSlide - 1 vs. .Previous, they actually work a bit differently.
I believe CurSlide - 1 would be preferable in certain cases (especially
if there are animations on the slide) while .Previous would be
preferable in other cases (especially if there are hidden slides, maybe).

--David

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
From: broro183 on

hi David,

Thanks for taking the time to give extra comments :)

In the past week while researching ppt VBA your book has popped up a few
times so I felt privileged to be involved in a thread where you were
taking part. I'll find out over the next week or so just how much ppt
work I'll be doing, and if it's going to add up, I'll see if I can get
the boss to spring for a copy of your book ;)

Thanks
Rob


--
broro183

Rob Brockett. Always learning & the best way to learn is to
experience...
------------------------------------------------------------------------
broro183's Profile: http://www.thecodecage.com/forumz/member.php?u=333
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=200002

http://www.thecodecage.com/forumz

From: Steve Rindsberg on

> I agree that the If statement is conceptually easier, esp in comparison
> to "flipping a select Case statement on its head" like I did. I think I
> did it that way because the concept was on my mind as I'd just been
> looking at some similar Excel VBA code.

Sometimes it's easier, sometimes not. Consider what an ugly mess this'd
be in If/Thens:

' given oSh, an object variable holding a reference to a shape
Select Case oSh.Type
Case 1,3,5,7,9
Msgbox "What an odd shape"
Case 2,4,6,8,10
MsgBox "Even shapes need love too"
Case 11,12
MsgBox "Howdy, big boy"
Case 13
MsgBox "Garlic! Silver Bullets!"
Case Else
MsgBox "Beats me, what do YOU want to do with it?"
End Select



==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


From: a1k1do via OfficeKB.com on
Thank you for the additional comments and alternative approach.

Steve Rindsberg wrote:
>> I agree that the If statement is conceptually easier, esp in comparison
>> to "flipping a select Case statement on its head" like I did. I think I
>> did it that way because the concept was on my mind as I'd just been
>> looking at some similar Excel VBA code.
>
>Sometimes it's easier, sometimes not. Consider what an ugly mess this'd
>be in If/Thens:
>
>' given oSh, an object variable holding a reference to a shape
>Select Case oSh.Type
> Case 1,3,5,7,9
> Msgbox "What an odd shape"
> Case 2,4,6,8,10
> MsgBox "Even shapes need love too"
> Case 11,12
> MsgBox "Howdy, big boy"
> Case 13
> MsgBox "Garlic! Silver Bullets!"
> Case Else
> MsgBox "Beats me, what do YOU want to do with it?"
>End Select
>
>==============================
>PPT Frequently Asked Questions
>http://www.pptfaq.com/
>
>PPTools add-ins for PowerPoint
>http://www.pptools.com/

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/powerpoint/201005/1

From: David Marcovitz on
Well, my book pops up a lot, not because it is so good, but because it
is the only book that is dedicated to PowerPoint and VBA. I learned a
lot of what is in the book right here in this newsgroup. I started by
asking questions just like yours. If the boss is paying for the book,
make him spring for a new copy. If you have to pay for it yourself, you
can probably find a good deal on a used copy somewhere online.
--David

On 5/3/10 8:38 PM, broro183 wrote:
> hi David,
>
> Thanks for taking the time to give extra comments :)
>
> In the past week while researching ppt VBA your book has popped up a few
> times so I felt privileged to be involved in a thread where you were
> taking part. I'll find out over the next week or so just how much ppt
> work I'll be doing, and if it's going to add up, I'll see if I can get
> the boss to spring for a copy of your book ;)
>
> Thanks
> Rob
>
>


--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland