writing macros in powerpoint, control property volatility problems

A

Anders Lindén

Hello!

I was putting a CommandButton directly on my slide in powerpoint 2000 SR-1.

When I click the button in design mode, the vb script editor came up.
Then, in the automatically created event handler, I tried to CommandButton1.Caption="foo".

When I run the presentation, the caption of the button is changed by the script, but when
I stop the presentation, that caption is still "foo". Its even "foo" when I run the
presentation the next time!

I want that caption to have an established value each time I start the presentation!

What have I foreseen?

best regards
/Anders Lindén
 
C

Chirag

All changes to VBA objects are persistent - they would remain changed. You
might want to add an event handler to handle start of slide show. This event
handler should reset properties of all VBA objects to the predefined ones
that you want. Look at free Event Generator add-in at
http://officeone.mvps.org/addins.html - it allows you to have such event
handlers in your presentation.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
A

Anders Lindén

Hello Chirag!
Thanks for your quick answer!

So I cannot make powerpoint presentations with macros that change text on buttons, having
defined start values for that texts without using 3rd part software?

Please tell me its a joke!

/Anders
 
C

Chirag

Hi Anders,

Setting a caption (through VBA or user interface) is like drawing a shape on
the slide. We would expect the shape to remain on the slide and not
disappear after the slide show ends. The caption too remains in its final
value. Like the 3-pane view, notes view, etc., a slide show view can be
thought of as another view for a presentation. All changes you make during
that view would remain.

- Chirag
 
S

Steve Rindsberg

Hello Chirag!
Thanks for your quick answer!

So I cannot make powerpoint presentations with macros that change text on buttons, having
defined start values for that texts without using 3rd part software?

Chirag didn't say that.

You can write your own event handling code (is it third party software if
you write it instead of Chirag? <g>) That will require an installed
add-in, which may or may not be practical for you.

Another possibility is to create your own navigation buttons that also
trigger a reset of your shapes. For example, you might have a "Click here
to start the show" on Slide1. User clicks that, it first resets all of the
buttons on the other slides to whatever values you like and THEN advances
to Slide2.
 
A

Anders Lindén

Steve Rindsberg said:
Chirag didn't say that.

You can write your own event handling code (is it third party software if
you write it instead of Chirag? <g>) That will require an installed
add-in, which may or may not be practical for you.

It would be third party software if someone else than microsoft wrote it.
If I have an add-in to powerpoint, will it be included in the ppt-file? Else it would not be a real solution to the problem, because
I want the ppt-file to run on any installation of powerpoint.

Another possibility is to create your own navigation buttons that also
trigger a reset of your shapes. For example, you might have a "Click here
to start the show" on Slide1. User clicks that, it first resets all of the
buttons on the other slides to whatever values you like and THEN advances
to Slide2.

Ok, such a button is maybe a good idea, at least before I have burned my presentation on cd-rom.
But isnt there _any_ event handlers that is executed "on load"?
 
A

Anders Lindén

Chirag said:
Hi Anders,

Setting a caption (through VBA or user interface) is like drawing a shape on
the slide. We would expect the shape to remain on the slide and not
disappear after the slide show ends. The caption too remains in its final
value. Like the 3-pane view, notes view, etc., a slide show view can be
thought of as another view for a presentation. All changes you make during
that view would remain.


But why didnt they solve it like they did with visual basic applications?
 
S

Steve Rindsberg

It would be third party software if someone else than microsoft wrote it.

Which'd include your own visual basic code then.
If I have an add-in to powerpoint, will it be included in the ppt-file?

No, it's in an addin (PPA) file.
Else it would not be a real solution to the problem, because
I want the ppt-file to run on any installation of powerpoint.

If you want to use VBA, that's not possible. A user's security settings may
prohibit your macros from running.
Ok, such a button is maybe a good idea, at least before I have burned my
presentation on cd-rom.

I don't understand how burning the presentation to a CD-ROM will affect
things, but maybe there are other limitations or requirements you haven't
mentioned?

In any case, this method of doing things is still subject to the user's
macro security settings.
But isnt there _any_ event handlers that is executed "on load"?

For all practical purposes, events can only be handled using an add-in. So
in your situation, no.
 
A

Anders Lindén

Steve Rindsberg said:
Which'd include your own visual basic code then.

At least, my visual basic code is not a way to extend the functionality of the scripting host, like a DLL that
makes it possible for me to have the event handlers I want. Because the add-in is a renamed DLL, isnt it?
No, it's in an addin (PPA) file.


If you want to use VBA, that's not possible. A user's security settings may
prohibit your macros from running.

It is always assumed that the user can deny us to run macros,
but I am the user of the powerpoint presentation, and I want to run the macros,
so thats not the problem.

presentation on cd-rom.

I don't understand how burning the presentation to a CD-ROM will affect
things, but maybe there are other limitations or requirements you haven't
mentioned?

Because when I burn it on a non-writable medium, I am sure whats on buttons every time I start the presentation.
 
S

Steve Rindsberg

I
At least, my visual basic code is not a way to extend the functionality
of the scripting host, like a DLL that
makes it possible for me to have the event handlers I want. Because the
add-in is a renamed DLL, isnt it?

COM addins are, but addins created in PowerPoint VBA and saved as Add-ins
are a form of PowerPoint file (PPA).
It is always assumed that the user can deny us to run macros,
but I am the user of the powerpoint presentation, and I want to run the macros,
so thats not the problem.

OK. That wasn't clear before. PowerPoint's fussy about this sort of
distinction, so we have to be also. ;-)
Because when I burn it on a non-writable medium, I am sure whats on
buttons every time I start the presentation.

I still don't understand the distinction, but if it makes sense to you,
fine.
 

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