Macros Powerpoint 2000 Problem

  • Thread starter Thread starter David Ogden
  • Start date Start date
D

David Ogden

Hello

I've got a strange problem using Macros that are linked to
command buttons. Each Macro opens one ".pps" file
presentation and closes the previous open file. The files
are stored on a CD-ROM. The Macros were recording using
the Macro recorder and use the Presentation.Open property.

When I run the files from the c:\ all the command buttons
work. When I record the files to CD, the presentation
will only work when Powerpoint is open in the background.
If I close Powerpoint and run the CD again, the command
buttons don't work.

Is there another Macro property I can use?

David Ogden
 
David,
I am pretty certain that your code is hardcoded to certain path which is
causing it to fail. Also macros don't work in the PowerPoint viewer too.
To correct your code, you will need to post the code here.

Regards
Shyam Pillai

http://www.mvps.org/skp
 
Shayam,

Code used in Macros is:

Sub <Macro Name>

With Application.Presentations("D:\MH Theory\<filname>.pps)
.Close
End With

Presentation.Open Filename:=D:\MH Theory\<filname>.pps",_
Readonly:=msoTrue

End Sub

Regards
David
 
Please scroll to end ...


Shayam,

Code used in Macros is:

Sub <Macro Name>

With Application.Presentations("D:\MH Theory\<filname>.pps)
.Close
End With

Presentation.Open Filename:=D:\MH Theory\<filname>.pps",_
Readonly:=msoTrue

End Sub

Regards
David

Is drive D: your CD or another HDD?

What does "Run the CD" mean? What exactly happens? Does it launch an
AutoRun.INF file? If so, what are the contents of the file?

Did you note Shyam's point about macros only working within PPT itself, not the
Viewer?
 
Steve

Sorry for being vague. To clarify the problem, the D:\
drive is the CD Drive.

If I close Powerpoint down, open My Computer, select the
disc on the D:\ drive the CD has one central ."pps" file.
The user double clicks to open the file. This file
contains a menu, where the command buttons are found that
is supposed to access the remaining ".pps" files when
buttons are clicked. If Macros will not work in Slide
Showview, how do you connect code to a button. I would
normally use the "Action Setting" option and either
hyperlink or Run Macro options.

The rest of the presentations on the disc will be hidden
to the viewer.

No Autorun files created at the moment. Something I'm
thinking about for the future.

David
 
Hi David. Thanks for the extra info.
Sorry for being vague. To clarify the problem, the D:\
drive is the CD Drive.

If I close Powerpoint down, open My Computer, select the
disc on the D:\ drive the CD has one central ."pps" file.
The user double clicks to open the file. This file
contains a menu, where the command buttons are found that
is supposed to access the remaining ".pps" files when
buttons are clicked. If Macros will not work in Slide
Showview, how do you connect code to a button. I would
normally use the "Action Setting" option and either
hyperlink or Run Macro options.

Macros can work in slide show view, but only if the presentation is being
viewed in PowerPoint itself; the free PowerPoint viewer doesn't support
macros.

But have you considered a solution that doesn't require macros at all?
To wit:

Each button on the main show is an action button that launches another PPS.
Each of these "sub-shows" runs in kiosk mode, so you have to supply your own
navigation buttons. One of of the buttons is an "End Show" action. When the
user clicks it, the sub-show closes, revealing the main menu (which has been
there all along, hidden behind the sub-show).

The tricky bit will be eliminating the hardcoded path. There are a few
inexpensive addins that allow you to edit the path, or there's some VBA code
you can use to roll yer own here:

Show me the link and let me edit it
http://www.rdpslides.com/pptfaq/FAQ00433.htm
 
David,
If I take your code literally as you have typed it here, your are
trying to open a file named filename.ppt which is not probably what
you intended. Are you trying to pass the filename as a variable? if so
you would have to get the filename as a variable and pass it something
like this modification
With Application.Presentations("D:\MH Theory\<filname>.pps)
.Close
End With

Presentation.Open Filename:=D:\MH Theory\<filname>.pps",_
Readonly:=msoTrue

With Application.Presentations("D:\MH Theory\" & filname & ".pps)"
.Close
End With

Presentation.Open Filename:="D:\MH Theory\" & filname & ".pps)",_
Readonly:=msoTrue

This is a different idea than either Shyam or Steve tried. Not sure it
it's what you mean or not and since I don't really perfectly
understand what you are doing, it is an untried sample.

Brian Reilly, PowerPoint MVP
 
Hi Brian

The <filename> I included in the code is just the name of
the presentation file. I'm using ".pps" files, not ppt.
At the moment, I'm not passing variables through. The
quote marks are used by VBA to indicate the filepath.

The full code of the D:\ file is:

With Application.Presentations("D:\MH Theory\Anatomy.pps")
.Close
End With

Presentation.Open Filename:="D:\MH Theory\_
End Section.pps",Readonly:=msoTrue

End Sub

If I put this code in the Declarations module of VB script
editor would this work?

David
 
The full code of the D:\ file is:

With Application.Presentations("D:\MH Theory\Anatomy.pps")
.Close
End With

Presentation.Open Filename:="D:\MH Theory\_
End Section.pps",Readonly:=msoTrue

End Sub

Another thought here; when you close Anatomy.pps, are you closing the file that
contains the macro that you're running at the time you're closing the file that
contains the macro that you're running at the <WHACK!>

Ooops. But you see what I mean, yes? Yanking the rug out from under the
thing, so to speak. And if you launch a presentation as a PPS then close it,
PowerPoint itself closes as well.

This could account for what you've described, I think.
 
Hi Steve

Thanks for your solution dated 30/04/04. I'm already
using this in the presentation. The major stumbling block
is trying to open one presentation and then closing the
last. The reason for this is that if several
presentations are open at once, this will cause memory
problems. I'll try and download FixLinks pro.

As to your last response (01/05/04) I am closing the file
that contains the macro. Is this the cause of the problem?
Any suggestions? Getting desperate now.

David
 
Thanks for your solution dated 30/04/04. I'm already
using this in the presentation. The major stumbling block
is trying to open one presentation and then closing the
last. The reason for this is that if several
presentations are open at once, this will cause memory
problems. I'll try and download FixLinks pro.

Much as I love selling another copy, FixLinks won't do anything for you in this
situation, I don't think. ;-)

But getting this to work is fairly simple if you think of it as a central menu
vs a linear progression of files.

Menu.PPT has buttons that launch PresA.ppt, PresB.ppt and so on.

Each of the sub-presentations has an End Show button at appropriate points.
When the user presses End Show, the presentation quits, leaving Menu.PPT
visible. From there, they can press another button to see the next
sub-presentation.

Another approach if you really need a linear progression of presentations is
something like:

PresA has a button to launch PresB.

The Next button on the first slide of PresB actually launches a macro that
closes PresA and moves to the next slide of PresB.

And so on.
As to your last response (01/05/04) I am closing the file
that contains the macro. Is this the cause of the problem?
Any suggestions? Getting desperate now.

In some cases, a vba subroutine running within a presentation will go to
completion even though the subroutine closes the presentation as part of the
sub, but I can't swear it'll work in all cases.

On the face of it, it seems unlikely.

But I think one of the suggestions above should work.
 
Back
Top