Link to home
Start Free TrialLog in
Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Corrupt PowerPoint slide master layout after applying simple VBA code

If I create a new presentation based on the standard blank Microsoft PowerPoint template, open Slide Master View, select the content placeholder on a suitable layout where the first level/paragraph has a bullet and enter this in the immediate window:

?ActiveWindow.Selection.ShapeRange(1).TextFrame2.TextRange.Paragraphs(1).ParagraphFormat.Bullet.Type=msoBulletUnnumbered

Open in new window

It returns True.

Now if write the same value to the same property:
 ActiveWindow.Selection.ShapeRange(1).TextFrame2.TextRange.Paragraphs(1).ParagraphFormat.Bullet.Type=msoBulletUnnumbered

Open in new window

I can no longer edit the bullet style in the PowerPoint UI and hence the layout is effectively broken.

Can someone confirm that this is not a Microsoft bug! A solution would be good too :-)
Avatar of AL_XResearch
AL_XResearch
Flag of United Kingdom of Great Britain and Northern Ireland image

What version of PowerPoint are you using ?

Does the presentation become 'un corrupted' if you remove the VBA ?
Avatar of Jamie Garroch (MVP)

ASKER

PowerPoint (PC) 2016. Once this property is set, the layout is corrupt unless Ctrl+Z is used to undo the change. There is no way to "remove the VBA" as it's not in a project but in the Immediate window of the VBE.
Sorry - my eye skipped over the 'immediate window' part :)

So do you get the same effect if you put the code in a procedure and call it from a button ?
Yes. In fact, this discovery happened as a result of calling a more complex function that styles bulleted text from a control in the ribbon. The feature works perfectly on objects on slides (both text boxes and placeholders) but it was noted that it failed to work with placeholders in the slide master. On a line-by-line debug, the issue was narrowed down to occurring [first] when the property above is being set and hence to eliminate all other add-in factors, the single line above was checked in the Immediate window.
Well I have tried this in PowerPoint 2010 and it does not corrupt the presentation.

Have you tried the code in a new session and a different file ?
I just tried in 2010 and it does the same thing for me e.g. after writing that property, it's impossible to enable/disable/style the bullet via the PowerPoint UI. I made a small video to show the effect (rename the file from .zip to .mp4 as EE don't support video file uploads!)

Bullet-issue-with-VBA-in-Slide-Maste.zip
ASKER CERTIFIED SOLUTION
Avatar of John Wilson
John Wilson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So it's a real bug then JSRWilson? Any chance of getting it through to MSFT? Knowing that this is an issue I can just report that it's not technically possible to style bullets in a slide master using automation.
I'll pass it on but it may not be high priority as not many people will be doing this and it goes right back to version 2007!