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

  • Thread starter Thread starter Bob
  • Start date Start date
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
 
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?
 
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
 
Thanks Steve,

It's weird and irritating.
A bug?

Any other forum that you suggest I float this to?


Bob
 
Back
Top