For Office users, the closest thing to a “programming language of the people” is VBA. It’s not too hard to get started, there are gobs of help information from a good search, and the results are immediate. But VBA’s abilities haven’t expanded as its environment has changed. This has become abundantly clear with current versions of Office, where task panes and the Windows-version Backstage haven’t been included in the VBA object model. Many want to edit OOXML with VBA, but Microsoft prefers to shuffle you off to the Open XML SDK programmed with C# to do that job.
Fortunately, we’re on the case at Brandwares. We collaborated with programmer Jan Karel Pieterse to develop a PowerPoint version of his macro set that edits Excel OOXML. We’re making this freely available as a download so you can get the benefit of this.
Let me apologize to my macOS readers. I really try to provide solutions that work cross-platform, but this macro set relies on Windows system calls.
I’ll be honest, this isn’t the most elegant OOXML editing solution. The macro set unzips the OOXML to its component files, gives you the opportunity to edit the XML using VBA string manipulation, then rezips the OOXML to a usable PowerPoint file. The unzip/rezip operations are fairly slow, especially with large files. It’s not something you can use in a real-time editing situation.
One of Brandwares’s specialties is converting legacy presentations to new themes/templates. Often, there are OOXML mismatches that make reused slides retain artifacts or formatting from the old decks. We solve these issues with macro convertors that take a folder full of old decks and transform them into new presentations with new branding. This macro set is great for that.
Edit OOXML with VBA: a Peek Under the Hood
THe file contains 3 VBA modules and 1 class module. Module modConvert is the only one you need to modify. In it, Sub MainVBAOperations does the actual work of opening files, saving as a work file, calling the XML process, saving the modified file and deleting the work file. This is also where you would do any additional VBA processing. As one example, after you modify the XML of a slide master or layout, you have to reset the slide based on it to display the changes. MainVBAOperations is where you would do this.
The other Sub is ProcessXML. Here’s where you unzip the file being modified, open different XML parts for find and replace processes, followed by a rezip of all files back to a working file. The sample code in this module shows a typical revision to the idx numbers of placeholders, a common requirement of legacy presentation conversions and one that can’t be done with the PowerPoint interface.
The module modDisplay, by Shyam Pillai, provides the PowerPoint equivalent of the Application.Screenupdating command that exists in Word VBA. Useful to prevent the screen flashing and jumping as files are processed, it also helps speed code execution. modUNC by Randy Birch, assists with file management.
Jan Karel Pieterse wrote the class module clsEditOpenXML that does the heavy lifting of unzipping and rezipping the document to be modified and reading and writing the XML.
As noted in the code, You are free to use this code within your own applications, add-ins, documents etc but you are expressly forbidden from selling or otherwise distributing this source code without prior consent. This includes both posting free demo projects made from this code as well as reproducing the code in text or html format.
Converting Legacy Presentations
We use often use this macro set to update old (legacy) presentations with a new design. Successful updating requires meeting 5 criteria, please read this article for more details: Legacy Slides – Best Practices. As noted on that page, the 5th requirement is that placeholder idx numbers in the OOXML must match on the old and new layouts. There’s nothing in PowerPoint’s interface that allows you to set idx number, but this macro set allows you to do just that. The pre- and post-processing sections of the macros allow you to set the the other 4 parameters for each slide layout. Click here to download it.
The following advice is particular to presentation conversion. It’s routine that slide masters and layouts will be changed in that process. Then, to apply those changes to the actual slides in a presentation, the slides must be reset, as if you pressed the Home>Reset button in a presentation. Resetting slides wipes out character-based formatting. If a user has applied bold or italic or an underline to particular text, that all will disappear. It’s important to notify your client of this. To make an exact update would require a painstaking construction of a multi-dimensional array for each placeholder on each slide that would record all character-based formatting, then restore it after the update, for which you would have to charge many times as much as for the basic conversion work.
Brandwares is a world leader in presentation updating and conversion. We’re available for presentation assessments, to identify potential problems. We have multiple techniques for seamless re-use of legacy presentations. Contact us when you’re redesigning to ensure your new template will reuse your old slides without a hiccup.
Replacing odd fonts and errant languages in PowerPoint is not something that always works well in the program. Problems with replacing double-byte fonts for Asian languages have been documented on other pages, but designers also have problems replacing Mac-only formats like AAT (Apple Advanced Typography) fonts.
There’s a similar problem with languages. While language tags are scattered all over in XML, you can only reach some of them with PowerPoint’s built-in Review>Language>Set Proofing Language (Windows) or Tools>Language (macOS) command. When files are moved between computers, it’s very easy for the file to have a mix of language tags.
In Windows, there are some free macros available to make replacing languages easier in PowerPoint, but there’s no equivalent for Macs. So here’s my go-to method to fix both problems with not much more than a good text editor, like NotePad++ in Windows and BBEdit on Mac. If you’re new to this site, please read my introductory articles OOXML Hacking: An Introduction and, if you’re on a Mac, OOXML Hacking: Editing in macOS.
Referring to the macOS article, a patient Mac user can use BBEdit 11 or better to open a presentation, select each file in turn and get the job done. But your time will be better spent by creating a network or USB disk that doesn’t create .DS_Store files. It’s a little time-consuming the first time, but if you’re someone who creates PowerPoint files on a regular basis, you’ll soon recover that time. The nice thing about this technique is that it always works, 100% of the time, even with double-byte fonts.
Replacing Fonts in PowerPoint
Unwanted fonts can be introduced when you’re doing design experiments, collaborating with clients, or when you convert a KeyNote presentation to PowerPoint. In all these cases, you may end up with fonts you cannot remove, or even with a deck you cannot save. Start by making a list of all fonts that need to be eliminated. You can get the names by choosing Home>Replace>Replace Fonts (Windows) or Edit>Find>Replace Fonts (macOS menu). Then expand the PowerPoint file to XML parts.
Now fire up your text editor. Both BBEdit and NotePad++ include utilities to find and replace in files. With both, you point the find at a folder full of expanded XML files from your presentation. In the Find field, look for typeface=”Font Name”, where the font name is the name listed in Home>Replace>Replace Fonts (Windows) or Edit>Find>Replace Fonts (macOS menu). The Replace field should also be typeface=”Font Name”, but here the font name is the font to match the rest of the deck. Executing the Find and Replace should display a list of files where changes were made. Both programs automatically save the changed files, so all you have to do is close the text editor and rezip the XML back to a presentation.
Windows users can take a shortcut with this process. PowerPoint for Windows has a save format called PowerPoint XML Presentation (*.xml). This saves the entire presentation as one big XML file. Open that file in plain old NotePad, choose Edit>Replace and do the same replacement as above. No fancy text editor needed! Then open the XML file in PowerPoint and save to a normal presentation format for your client.
Replacing Languages in PowerPoint
PowerPoint puts language tags all over the place. Here’s a random sample showing one paragraph with one word that contains 2 different language tags!:
The technique is nearly identical to font replacement, you just search on a different tag. In the example above, we would find lang=”en-CA” and replace it with lang=”en-US” to create a uniform U.S. English presentation. Here at Brandwares, we do a lot of international work, so files can have language tags from all over. A standard part of file finalization is replacing language tags with the target language for the client.
When you’re working with OOXML files, multifile find and replace is a very useful technique to solve all kinds of problems. As another example, here’s my article on fixing broken color themes with similar techniques: OOXML Hacking: Repairing Color Themes. Mastering multifile find and replace can save you hours over manual repairs to PowerPoint files.
Is your problem more complex? You just can’t get the result you want with find and replace? That’s why we’re here, to help you get your work done faster! Shoot me an email at email@example.com, I’ll get you going in a jiffy.
Microsoft doesn’t have a catchy name for this feature, but I’ll try to describe it. In Word for Windows, you can select document text, then apply Read-only protection, but with Exceptions. By default, the exception is Everyone. If we untangle the word logic, this means that the document becomes read-only except that everyone can edit the selected text. It’s a far better solution than the old protection for forms.
When this type of protection is applied, the selected areas become shaded in light yellow as a visual cue that the highlighted text remains editable. Users of Word 2016 for Mac and 2019 for Mac (including Microsoft 365 subscribers) can use these documents, but can’t produce them. At least, until now.
Word pros will look at the square bracket and think it’s a bookmark. It’s not. Microsoft reused the bookmark character to show a Permission Range. To add these editable ranges on a Mac, we’re going to create one manually.
To start, apply Read-only protection to the document. Use Tools>Protect Document, then check Protect document for. Click on Read only, then on OK. Save the file.
Now open the file in your XML editor. OOXML Tools in the Chrome browser is fine for this job. Open document.xml inside the word folder.
Just before the text that you want to be editable, insert a line like this:
The beginning and end tag must have the same 9-digit random number. Each pair of tags in a document must have a different random number.
Here is a whole paragraph marked as editable:
<w:permStart w:id="783447734" w:edGrp="everyone"/>
<w:t>To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other.</w:t>
There are more AutoShapes in Office than appear in the user interface. Over time, Microsoft has quietly added to the collection stored in Office. Many of the more recent shapes are used in SmartArt files, while others have no current use that I can detect. But for anyone who hacks XML or codes VBA will find this week’s download or every autoshape a useful reference.
I’m preparing to start a series on custom SmartArt files. This is a deep topic: SmartArt XML is a programming language with a Frankenstein syntax. But the starting point for any language is to get the names right. SmartArt and VBA both reference the AutoShapes collection in Office, but they use different names for the same objects. Many of the same shapes are seen in the Shapes dropdown of Office programs, but those names are also different. The main source of the VBA names are from this page: MsoAutoShapeType enumeration (Office), while the XML names come from this out-of-date listing: SmartArt AutoShapes.
So, for my own sanity, I created a Word document showing an example of each shape, along with it’s name in XML, in VBA and in the user interface. This has smoothed out my workflow, and it may help you as well.
For any non-interface shapes, you can insert them into a document with code analogous to this. For PowerPoint:
ActivePresentation.Slides(1).Shapes.AddShape msoShapeTrapezoid, 24, 24, 144, 144
Change the bolded word to the shape name in the VBA MsoShapeType Name column.
Some shapes have specialized VBA commands, like callouts:
ActivePresentation.Slides(1).Shapes.AddCallout msoCalloutTwo, 24, 24, 144, 144
Callouts led me to a discovery about legacy versions. msoCalloutOne gives exactly the same result as msoCalloutTwo in current versions of Office.That seemed odd, so I ran the same macro in PowerPoint 2003 (I still have it installed for its macro recorder). In that version, msoCalloutOne creates a callout with a vertical leading line that can be moved up and down, but not at an angle. Presumably, MS found that useless and deprecated it.
We’re proud to be hosting a free e-book Open XML Explained. Finding readable explanations of how Office Open XML works isn’t easy. Outside of the very dense published ECMA standards, most of the information exists only on the web in help pages and blog posts. Back in 2007, a developer in the Netherlands, Wouter van Vugt, published a well written PDF that goes into details about the XML formats used in Word, Excel and PowerPoint. This was originally posted on the openxmldeveloper.org website run by OOXML genius Eric White.
Eric’s site closed down some years ago and much of the content disappeared. But I’ve been able to track down a copy of Wouter’s book and have his permission to give it a new home here at Brandwares. Download Open XML Explained.
The e-book covers Excel, Word and PowerPoint in depth, covering otherwise obscure topics like table formatting, bullets and charts. It’s an excellent companion to my book, covering the theory behind my practical techniques. OOXML hackers will appreciate the explanations of all the major XML parts in an Office file, while coders will find this a useful resource in learning how to programmatically create and modify documents, workbooks and presentations.
I should note that Open XML Explained was written in 2007, so while it covers all the OOXML basics, it doesn’t have any information about newer features like the Backstage or SuperThemes. Reader David Wiggins was kind enough to find the sample files that accomapied the book. The download page has a link to them as well. Enjoy!
SOLD OUT! The paper copies of the book are all gone, please watch for the ebook version.
After years of original research, you can finally buy the book! Filled with unique information not found anywhere else, online or in print, this manual shows you how to build SuperThemes 3 different ways, how to create custom Effects Themes, how to edit the Ribbon in macOS, and much more!
The book expands on many of the brief articles on this site, putting them in logical order and expanding the number of examples. Author John Korchok explains how Office Open XML files work, shows you where to find each XML part and how each part can be modified. With these tools, you can provide unique services to your clients or users that you can’t find at the average Office template service bureau. To give you a better idea of what it covers, here is the Table of Contents:
All techniques are covered in both Windows and macOS. The book includes a link to a downloadable text file with all the hyperlinks, XML and VBA listings, so you don’t have to retype anything from the printed page. At this time, only print copies are available, ebook versions will be here in several months. To buy the book, click here.
A bug in PowerPoint Online can wreck presentations edited there. This article describes the symptoms and how to do a notes page repair – if you use Windows. Mac users cannot fix this issue because of sloppy Microsoft programming in the macOS version.
PowerPoint Online can resize the Notes Master page of a presentation. It can also resize elements on the Notes Master, leading to a really wacky combination of large and small placeholders. Almost always, the page size is made much smaller, often into a thin but tall rectangle. The exact cause hasn’t been determined yet, but it may be caused by editing Notes. PowerPoint Online can’t display either the Notes Page or the Notes Master for a presentation, so this problem goes undetected until the presentation is downloaded and viewed in the desktop version. Do a quick Google search on notes page wrong size site:microsoft.com to see lots of examples.
There are three steps to a notes page repair, and it starts with an XML hack. Open up the presentation in BBEdit or OOXML Tools (macOS) or unzip it (Windows). Find the presentation.xml part. In human-readable form, the 13th line will be the Notes Master page size. This example shows the normal values:
<p:notesSz cx="6858000" cy="9144000"/>
The hack involves resetting these values to normal, then saving and closing, or rezipping the files. But that’s just 1 of 3 steps. The next 2 steps can be done in the program.
Open the presentation in PowerPoint, then choose View>Notes Master. Very likely there will be wrong-size shapes or missing elements. To fix this, uncheck, then recheck each of the 6 elements (Header, Slide image, Footer, Date and Time, Body and Slide Number). This restores them to the designed co-ordinates.
The third step notes page repair is to reset each Notes Page to follow the Notes Master. This is where the Mac version runs into trouble. In the Windows version of PowerPoint, open the Notes Page for each slide and right-click on the background. This is the context-aware menu you’ll see:
Click on Notes Layout, then on Reapply master. The Notes Page reverts to correct formatting.
Now let’s look at the same operation on a Mac. Right-click on the Notes Page and what do we see?
This is not a “context-aware” menu. This is exactly the same menu that you get if you right-click on a slide. The available commands make sense for a slide, not for a notes page. There is no option to reset the page to the Notes master. The Mac programming team got lazy and just reused the same menu.
As a result, Mac users can’t complete a notes page repair. They can’t reset the page back to the original format.
But wait! What’s that? I hear you say, you read about a macro that can reapply the Notes master. Yup, it’s here on Steve Rindsberg’s awesome PPTFAQ site: Reapply the Notes Master to each Notes Page in a presentation. Except that macro raises an error on Mac version of PowerPoint, because the control ID can’t be found.
Microsoft has f***ed this one badly. First, through the PowerPoint Online bug that creates this, and remains unfixed until the date of this post. Second, because of the sloppy “context-aware” menu programming. And third because they can’t provide PowerPoint for Mac with a complete list of controls in the VBA object model.
As a last resort, create a new blank presentation from the same template as was used for the original file. Then copy and paste the slides from the damaged deck into it. Thanks to Christa Barnes for this suggestion in the comments.
Since I first wrote this article, John Wilson in the UK has written a pair of Windows-only repair utilities to fix this problem. Here’s the page where you can download both, one to fix the Notes Master and another to reapply the master to the Notes Pages. Give them a try, it’s a little easier than revising the XML.
Bad design decisions haunt our lives. One poor choice was Microsoft’s selection of the text baseline for vertical bullet alignment in PowerPoint. Bigger bullets move up, smaller bullets move down, without any control in the user interface. I’m sure you’ve seen this effect as you change bullet size relative to text:
Fixing Vertical Bullet Alignment with VBA
There are a couple of ways to fix this issue. One is to download and install this free Add-in by John Wilson of PowerPoint Alchemy: Bullets Move Up and Down. The VBA code behind this add-in looks something like this:
Dim oDes As Design
Dim oMast As Master
Dim L As Long
Dim oCust As CustomLayout
Dim oshp As Shape
For Each oDes In ActivePresentation.Designs
For Each oCust In oDes.SlideMaster.CustomLayouts
For Each oshp In oCust.Shapes
If oshp.Type = msoPlaceholder Then
Select Case oshp.PlaceholderFormat.Type
Case Is = ppPlaceholderBody, ppPlaceholderVerticalBody, ppPlaceholderObject
For L = 1 To oshp.TextFrame.TextRange.Paragraphs.Count
.BaseLineAlignment = ppBaselineAlignCenter
MsgBox "Masters and layouts fixed", vbInformation, "PowerPoint Alchemy"
When this runs, it adds an over-ride to the text level definitions on each slide layout that has multi-level text (any layout containing a Content or Text placeholder).
This is adequate for most purposes. With correctly aligned bullets, we now get this effect when we change the bullet size:
There are a couple of downsides to the VBA approach:
You have to remember to apply it to each presentation or template.
If you add a new layout, or add a new text or content placeholder to an existing layout, you’ll have to re-run the macro.
Table text and text box text does not benefit, their bullets will still be wonky.
Fixing Vertical Bullet Alignment with XML Hacking
With XML hacking, we can fix this problem once and never have to think about it again. Start by unzipping a new blank template, then editing ppt\slideMasters\slideMaster1.xml. There are 3 sections to be edited: p:titleStyle (for all title placeholders), p:bodyStyle (for all text or content placeholders) and p:otherStyle (for table text).
The editing is the same for all sections: for each a:lvlXpPr section, where X is the level number, add fontAlgn=”ctr” to the definition. Here’s what it looks like before…
There are 19 level definitions in slideMaster1.xml to change. When you’re done that, open ppt\presentation.xml and make the same edit to the 9 levels of the p:defaultTextStyle section that controls formatting for text boxes and notes and handout pages.
When you’re done, rezip the XML files and rename the template blank.potx. Place it so it works as your default template, here’s an article from Steve Rindsberg with the details for each Office version. For PowerPoint 2016 and 2019 for Windows, follow the PowerPoint 2013 directions. For 2019 for Mac, use the Mac 2016 directions: Create your own default presentation.
Now that this is set in your default template, every new file created when PowerPoint opens will have the correct vertical bullet alignment. Please note that in PowerPoint for Windows, if you choose File>New>Blank Presentation, this autogenerates a new file that is not based on your default template. Such a file will have incorrect vertical bullet alignment.
Having worked with many great designers, I see that they try to create variety in chart appearance rather than uniformity. So what if there was a way to have make a chart layout with the colors in a different order? This could give you layout color variations while sticking to the branding guidelines. Well, I have a solution for you, but you’re gonna have to hack some XML!
Normally, every layout under a slide master has only 1 color theme. You’re mostly stuck with those 10 colors in a fixed order. In my earlier article about Great Color Themes, I explained how the sequence of colors determines the color order of charts.
But during some recent research, I started reading about the <p:clrMapOvr> XML element. This can be applied to a slide layout to rearrange the color theme. With Accents 1 to 6 in a different order, charts can acquire a whole new look. Here’s how it works.
Layout Color Variations with clrMapOvr
At the end of most layouts, you may have seen this XML:
This tells the layout that it should use the standard color mapping as defined in the theme. We would think of this as the default or normal set of colors. But what if we want to alter this sequence? We can assign each color theme value to a different task. If you import a PowerPoint 2003 or older deck, this gets generated automatically to keep the deck looking as expected.
This reverses the order of accent colors from the master, giving charts, fills and shapes a whole new look for the slides based on this layout.
We used to tell clients “Sorry, we have to set the color order to match only one of your designed charts.” Now we have a different message: “Different chart color sequences? No problem. Just use a different layout!”
If XML hacking doesn’t interest you, Brandwares can do it for you. We’re a full-service template creation service for all Office programs. Email me at firstname.lastname@example.org with your project details.
Please note: Microsoft has modified the nature of OLE links. It’s no longer possible to maintain relative OLE links (linked Excel and Word) in current versions of Office. The directions below will allow you to re-establish a broken link, but when you update the linked file, PowerPoint will write an abolute path. If you’re relinking other object types, like images, audio or video, this article will allow you to create permanent relative, semi-relative and absolute paths.
Someone sends you a presentation linked to an Excel file. The links don’t work and you can’t fix them without redoing them. Here’s how to fix broken PowerPoint links with a one minute of XML Hacking.
This article is really just for PowerPoint for Mac users. If you have the Windows version, you can fix broken links by choosing File>Info, then clicking on Edit Links to Files in the right-hand column under Related Documents. (Please note, the Edit Links option only appears if you actually have a link in the open presentation.) Word and Excel for Mac already have utilities to fix links.
If you haven’t hacked XML before, please read XML Hacking: An Introduction and XML Hacking: Editing in macOS. This article mentions Excel, which I’ve used as an example, but the same advice is true for Word files linked to PowerPoint. OLE Links to other formats, like PDF, are simply not supported on macOS.
In Office, links to documents include the complete path. Of course, when you move those linked files to a new computer, the path is always different, so the links must be corrected. The symptoms of a broken link depends on the type of link that was created. If the file creator selected a workbook section or chart, then used Paste Special to paste in a link, you’ll see this message when you double-click on the Excel excerpt:
But the creator may have used Insert>Object instead, and chosen to link rather than embed the file. Then you’ll see this when you try to edit:
Then after dismissing that dialog, you’ll see the first one about the server error.
Fix Broken PowerPoint Links – The Steps
The issue is that a path is embedded in the PowerPoint file, and that path must be edited. Open the file in BBEdit.
The XML we need to change is associated with the slide(s) on which the Excel item is placed. So lets look. In the left-hand window, click on ppt. Then select slides then the _rels folder. Rels is short for relationships, and it’s the mechanism in every OOXML folder that tells PowerPoint where to find the objects in use.
The _rels folder has a .rels file for each slide in the presentation. Open the file for the slide containing the linked Excel. If the link was inserted using Paste Special, it will look like this (Pay attention to the third line and scroll all the way to the right. The path to be edited is in bold):
Since the Excel item was inserted on a Windows computer, the path uses backslashes instead of forward slashes. There are two path syntaxes that are acceptable. If both the file linked to and the presentation containing the link are in your User folder, you can use a relative path and the linked file will open up immediately. If the file linked to is on a network share or somewhere on your disk outside your user folder, you will have to use an absolute path and you will get a challenge from Office when you open the link.
Let’s do the relative path first. In this example, the Excel file is in my user Documents folder and the PowerPoint is in my user Downloads folder. So I edit:
In Unix/DOS speak, the 2 dots mean “go up one level”, out of the Downloads folder where the presentation is into the main user folder. Then the slashes lead you down into the Documents folder and subfolders to the Excel location. Once you set a relative path, you must leave the PowerPoint file in the same folder. Moving it will break the path.
Fix Broken PowerPoint Links – The Best Relative Path
For a linked file that you know will be moved from desktop to desktop, the best strategy is to place both files in the same folder. Then use this path:
Now even if you move it back to Windows, the linked Excel file will open as expected. As I noted above, when you open or update the linked Excel (or Word) file, PowerPoint will replace your relative path with an absolute one. This only happens with OLE links. For picture, audio, video and other file types, the relative link will remain unless you manually update.
Fix Broken PowerPoint Links – Absolute Paths
If the file to be linked to is on another disk, use an absolute path. With an absolute path, you can move the PowerPoint file anywhere on your computer or to other machines and it will still be able to find the linked file. Here’s what an absolute path looks like:
Important! A macOS absolute path must begin with Volumes, followed by a slash and the name of the disk. If your network is set up for different operating systems, you’ll probably use an IP address instead, as shown in the original file path. Consult with your IT department.
Office 2016 for Mac applications are sandboxed applications, so when you first open an Office file linked with an absolute path, you’ll see a warning:
Click on Select…, then you’ll see:
Select the correct file if it isn’t already selected, then click on Grant Access. Now double-click on the linked Excel item to edit and you’ll see this again:
OK, that’s something of a hassle, but the good thing is that you won’t see those warnings again as long as the linked file says in the same place with the same name. You also only get warned once per placed file, even if there are multiple uses of that file in your presentation.
Linked files are a huge benefit when you have a data source that is constantly being updated. Using them means your presentation can always be up to date. Now that you know how to fix the links, you have a very useful new tool.