Powerpoint VBA best approach

R

Roger Seiler

I got stuck on an task and was wondering if any of you have got some advice
on this.

Situation:
I'm supposed to write a configurator. There are parts that you can customize
and each of these parts has diffrent characteristics. You can place these
parts within the presentation and it should calculate the final price of
your personal configuration.

My approach:
2 Slides.
In the first slide there is a basic layout of the package you can buy
without customizing it. (layout slide)
In the second slide (parts slide) I thought of having an arsenal of parts
and by clicking on them the part gets added to the first slide and the user
can place it where he wishes and fit it into the whole assembly.
I thought of using the class modules to make a template for all of these
parts. By clicking in the parts the part is added to the first slide.Now I
got stuck as I wanted to make a parts generator that makes parts according
to the class module and then hands it over to the first slide. Is there a
good way of coupling the price to the graphical representation without using
class modules. The tricky part is that I thought of making an array
containing all the added objects and then summing up the prices. This is
where I got stuck and thought I'd post to see if I am completely off track
with my approach.

As a noob to VBA I would apreciate some advice.

Roger
 
B

Bill Dilworth

The way I would do it, would be to add an object tag to each object with the
price, then at the end, just run thru the objects and add up the end price.

This should point you in a better direction.

--

Bill Dilworth
Microsoft PPT MVP Team
Users helping fellow users.
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 
R

Roger Seiler

Thank you very much for your input!!!

Roger

Steve Rindsberg said:
Bill's put you on the right track. A presentation, any slide in it or any
shape on any slide can have any number of "named" tags that contain text
information (not numeric but the conversion's easy).

For example, given a reference to a shape in oSh, you can:

oSh.Tags.Add "PRICE", "29.95"

Now suppose you copy this shape to Slide 1 whenever the user clicks it.
Later you could do this to total the prices of parts on the first slide:

Dim oSh as Shape
Dim dTotal as Double
Dim sReport as String

For Each oSh in ActivePresentation.Slides(1).Shapes
if oSh.Tags("PRICE") <> "" Then
dTotal = dTotal + cdbl(oSh.Tags("PRICE")
' may as well prepare a report while you're at it
sReport = sReport & oSh.Tags("DESCRIPTION") _
& vbtab & osh.Tags("PRICE") & vbcrlf
End if
Next
sReport = sReport & vbcrlf _
& "TOTAL" & vbtab & cstr(dTotal) & vbcrlf
' Now you have a parts list too

This may be helpful also:

Determine which shape was clicked
http://www.rdpslides.com/pptfaq/FAQ00141.htm



-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top