VBA problem w Layout Reset. Manually stepped code gives good result. Run code doesn't work!

B

Bob

Hi,

I am trying to automatically update Layouts for all our presentations.

The follwoing code works great when stepped through line by line, but
produces nothing when run:

Sub SlideDesign()
On Error Resume Next
Dim oSld As Slide
ActivePresentation.ApplyTemplate FileName:=Environ("APPDATA") &
"\Microsoft\Templates\Blank.potx"
ActivePresentation.Tags.Add "TemplateVersion", "Vers3"
ActivePresentation.Tags.Add "AutoFooter", "on"
For Each oSld In ActivePresentation.Slides
oSld.CustomLayout = oSld.CustomLayout
Application.CommandBars.ExecuteMso ("SlideReset") ' Does same as
above, should be redundant in theory...
Next oSld
End Sub

Very strange!
Any thoughts:
- forcing a refresh?
- pausing?
- running through all the objects?

Thanks,

Bob
 
J

John Wilson

Your code works here Bob (with and without the redundant line) I take it this
is a 2007 file?

Have you tried it without the 'On Error Resume Next' Line?
 
S

Steve Rindsberg

I've run into something that smells vaguely like this in presentations with
multiple masters and, IIRC, when the slide I was working on was based on other
than the first master. Stepping through the code manually worked, running it
at full speed didn't.
 
B

Bob

Hi,

Nope, the slides are quite simple. No multiple masters.

The code (I distribute an Addin), actually works on a colleagues
computer....
This really worries me, if I can't know on which computers the code works.
I had the same problem with Excel 2000 and another machine many years ago.
Got it to work by declaring everything meticulously and some refresh
function.

But I'm lost with PPT 2007
:-(

Bob
 
S

Steve Rindsberg

Nope, the slides are quite simple. No multiple masters.
The code (I distribute an Addin), actually works on a colleagues
computer....
This really worries me, if I can't know on which computers the code works.
I had the same problem with Excel 2000 and another machine many years ago.
Got it to work by declaring everything meticulously and some refresh
function.

But I'm lost with PPT 2007


I've come back to this a couple times now and still don't have any further
ideas, Bob.
 
B

Bob

Thanks Steve,

It's weird and irritating.
A bug?

Any other forum that you suggest I float this to?


Bob
 
S

Steve Rindsberg

Thanks Steve,

It's weird and irritating.
A bug?

Any other forum that you suggest I float this to?

A bug, I'm sure. Can't think where else to post it unless you want to try the
regular Public.PowerPoint group (several PPT developers hang out there too).

If you can get it to repro fairly reliably (ideally on several machines) you
might also want to report it here:

How do I send PowerPoint 2007 feedback or report bugs to Microsoft?
http://www.pptfaq.com/FAQ00962.htm
 

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

Similar Threads


Top