The macros in this project are disabled?

G

Geoff Cox

Hello,

I have added a macro but the Run command in Tools/Macro/Macros is
greyed out. If I try running the macro from the VBA Editor I get the
error message "The macros in this project are disabled etc" .. and the
mentions the host application?!

I have tried various options from MS but cannot get the Run command
back.

If I add the macro to another ppt this will work so why not in the
other ones?

Also, how do I run a macro which works on all files in a folder? Must
I do this from within one of the ppt files? Cann't I run VBA Editor
separately from the ppt file?

Lastly the following code adds an action button to the first slide in
each presentation (except the ppt file from which I am running the
macro!) but I want to add the action button to the last file of each
ppt file .... how do I do this?

Cheers

Geoff

PS you can see that I am trying to combine code from Steve's web site
with a macro recording ...

Sub ForEachPresentation()
' Run a macro of your choosing on each presentation in a folder

Dim rayFileList() As String
Dim FolderPath As String
Dim FileSpec
Dim strTemp As String
Dim x As Long

' EDIT THESE to suit your situation
FolderPath = "c:\fred\activities\" ' Note: MUST end in \
FileSpec = "*.ppt"
' END OF EDITS

' Fill the array with files that meet the spec above
ReDim rayFileList(1 To 1) As String
strTemp = Dir$(FolderPath & FileSpec)
While strTemp <> ""
rayFileList(UBound(rayFileList)) = FolderPath & strTemp
ReDim Preserve rayFileList(1 To UBound(rayFileList) + 1) As
String
strTemp = Dir
Wend

' array has one blank element at end - don't process it
' don't do anything if there's less than one element
If UBound(rayFileList) > 1 Then
For x = 1 To UBound(rayFileList) - 1
Call MyMacro(rayFileList(x))
Next x
End If

End Sub

Sub MyMacro(strMyFile As String)
' this gets called once for each file that meets the spec you enter in
ForEachPresentation
' strMyFile is set to the file name each time

' Probably at a minimum, you'd want to:
Dim oPresentation As Presentation
Set oPresentation = Presentations.Open(strMyFile)

With oPresentation


ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeActionButtonForwardorNext,
189.88, 389.12, 153.12, 39.62).Select
With
ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick)
.Hyperlink.Address = "C:\a-temp1\fred\menu.ppt"
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
End With
With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseOver)
.Action = ppActionNone
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoFalse

End With

oPresentation.Save
oPresentation.Close

End With
End Sub
 
G

Geoff Cox

with ActivePresentation.Slides(ActivePresentation.Slides.Count) _
.Shapes.AddShape(msoShapeActionButtonForwardorNext, _
189.88, 389.12, 153.12, 39.62)

With .ActionSettings(ppMouseClick)
.Hyperlink.Address = "C:\a-temp1\fred\menu.ppt"
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
End With

' delete the next five lines if you don't need to add a mouseover
With .ActionSettings(ppMouseOver)
.Action = ppActionNone
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoFalse
End With

End with

Steve,

Thanks - the above change adds the button to the last slide but a
couple of things,

1. I select the last ppt file in the folder and add the macro to it.
When I run it the button is added to the last slide of all the ppt
files above the last one but is not added to the one with the macro
and also when I try to save this last file, not possible as it is
"read only". Why is this?

2. to get the code which you replaced I used the macro record option
to create the action button, its hyperlink and also dissolve custom
animation for it so that it appeared after all the other animations on
this slide had appeared - they being made to appear by pressing the
enter key. If I ran that code in the ppt file in which the macro was
created it did put a button with the above properties but when I used
this code as part of the macro to go through all the files, the button
was created on the last slide of each presentation but the dissolve
custom animation was not carried over.

Perhaps simpler just to ask how your code above can be altered to add
the dissolve custom anination?!

Any ideas please!

Geoff
 
G

Geoff Cox

That's what we'd call a DDT. Hold out your hand. SMACK! Don't Do That.

Put the macro in a PPT file in a different folder than the one you're trying to
process, otherwise the macro tries to open the file that it's already running
from, the snake eats its own tail and ... don't do it.

Steve,

I guessed that was the problem but didn't think of putting it in a
file in another folder! Would seem to me to be better if VBA editor
could work independently of the PPT program?
This is in 2002 or 2003? The recorder doesn't pick up much (if anything) of
the new animation features in versions after 2000.

2003 version.
Let's see if one of the animation wizards can help with that one.

Sorry. How do you mean?

Cheers

Geoff
 
G

Geoff Cox

On Mon, 10 Apr 2006 21:38:05 EDT, Steve Rindsberg

Steve,

I have just tried the Tools/Options/View and unchecked the black
screen option and this works fine with PPT 2003 itself but of course
does not work in the PPT Viewer ... I'm just moaning about this!

It would be so good if it could be used. Is this just an oversight in
the PPT Viewer design? Tthe Viewer design has not caught up with the
application?

Is there a way to pass requests on to MS?

The other moan is that even if I add action buttons to the last slides
so that clicking on these button goes to the menu slides, there is
nothing to stop the user pressing the enter key and getting the black
screen. Using kiosk setting is no good as that cannot be used on only
the last slide and prevents the animations being started on the other
sldies.

Seems a catch 22 situation!? Or have I got this wrong?!

Cheers

Geoff
 
G

Geoff Cox

On Mon, 10 Apr 2006 21:38:05 EDT, Steve Rindsberg

Steve,

Assuming I got things right in previous posting, my best bet seems to
be to have the action button on each of the last slides, linking to
the menu file but I need to be able to add the custom dissolve
entrance animation to each button so that the user only sees the
button after the rest of the slide's contents have been displayed.

Then it seems obvious that the next step for the user is to click on
the button rather than pressing the enter key again.

So back to how to get the macro to add this animation to all the
slides and your suggestion of the animation wizards!

How might these wizards help?

Cheers

Geoff
 
G

Geoff Cox

Apparently not. Somebody at MS clearly thinks this is a feature, as they
absolutely WILL not be convinced to get rid of it. Pity.

Steve,

I would have thought that because the look of this screen is so
different form the ones people are creating themselves, it would be
obviously worth giving people the option to design their own. Strange!
One of those "be sensible, see it my way" situations!

Cheers

Geoff
 

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