Chart templates solve the old problem of having to send out copy-and-paste samples of graphs. But they only display the first 6 of the chart template colors you designed.
Adding More Colors
The most common application of chart templates is to overcome the design limitation of having only a 6-color palette to work with. I wrote about this problem years ago: Office Charts: 6 Colors Maximum! – Best Practices. After a chart uses Accents 1 to 6, it starts recycling those same 6 colors with automatically generated darker and lighter variations. Banks and wealth management clients often need many more than 6 data series in their charts, but still want to have colors that are on-brand and designed.
To create a wider range of data series colors, create a chart with the maximum number of data series that the client requires. Our record is 25 colors! Then right-click on the chart edge and choose Save as Template. This captures the formatting of the sample that you’ve created.
Your template will work just fine on charts that have already been created. Select the chart, choose Change Chart Type (yes, even if it’s the right type already), click on the Templates icon, select the chart template and click on Apply. Easy peasy, job done!
The New Chart Problem
But this process breaks down if you try to create a new chart from that template. Choose Insert>Chart, click on Templates, and select the chart type. Then start inputting data. As soon as you get past the 6th color, Office starts using those damn Microsoft default darker and lighter variations instead of the colors you set! This is Authoritarian Helpfulness at its worst!
Yes, you can fix this. Reapply the template by choosing Change Chart Type>Templates and reselecting the template. The colors are corrected to the design specs. But you shouldn’t have to do this! And now that you’ve found this article, you don’t have to.
Understanding Chart Template Colors
Let me back up a bit, and explain how chart templates are structured. The top level of the XML consists of [Content_Types].xml, a _rels folder for documenting the relationships of XML parts and a chart folder holding the good bits.
Inside the chart folder, we find chart.xml, which holds most of the formatting that we created when we made the custom chart. Chart.xml contains definitions that contain the intended series color. The colors in chart.xml get set when you save the file as a chart template, and they get used when you apply the template to an existing table. But they are not used when you create a new chart.
Each series is numbered starting with 0, so this is the series for the 7th color. For the first six, the color is set to an accent color. Starting with the 7th, the color fills are in RGB/hexadecimal. Here’s a sample:
In addition, there are subfolders for charts, media, theme, and _rels. The media folder only holds a BMP file that is used for thumbnail display in Office 2007 and 2010, but not in later versions. The _rels folder is for relationships of XML parts. The theme folder contains themeOverride1.xml. As the name suggests, this is a theme that overrides the theme of an Office file that hosts it. This allows you to use a chart template in any Office document while retaining the original design appearance. Finally, we have the charts folder, which has the XML part we’re looking for.
This folder contains 2 files: style1.xml, containing the formatting for all the chart parts and colors1.xml, with a list of default fill colors and transforms fo apply to those colors. Colors1.xml is the file that supplies the colors when a new chart is created from the template. Here’s what colors1.xml looks like:
On a newly inserted chart, an Office program will use the 6 colors in turn. Then it will cycle through them again, applying the a:lumMod val=”60000″ transform. LumMod modifies the luminance, turning each accent color to a dark version. The chart will follow this pattern instead of using the colors you designed for the extra data series. If you reapply the chart type to the chart, then it will update with your designed colors from chart.xml
Fixing Chart Template Colors
My first step was to read the Microsoft specs for cs:colorStyle. Under section 184.108.40.206 CT_ColorStyle, it reads: “The total set of colors is all contained colors repeated each time with each variation applied. A color style can contain 6 colors and 7 variations. This yields a total of 42 colors with the first 6 having the first variation applied, the second 6 having the second variation applied and so on.” Not promising, we really need more than 6 colors here.
After many fruitless experiments, I decided to see if I could add extra colors anyway:
To my astonishment, it worked! I could create a new chart and insert 10 dataseries with each displaying the designed color. No need to reapply the template! Who would ever have dreamt that Microsoft documentation has a mistake in it! ;-D
The takeaway is that to create a many-colored chart template that works as expected under all circumstances, you need to set the extra color values manually in colors1.xml.
Unlike PowerPoint, Microsoft Word has a utlity to create custom Word table styles. You might think this makes life a lot easier, but you would be wrong. The Word utility has quirks and bugs, and Word tables don’t work the same way as PowerPoint’s. To get a Word table style to work closer to the way it should, you may have to hack the OOXML. Here’s how to get the best possible results.
Start with a similar table style
The first step in creating a custom table style is to insert a table, so the Table Design tab appears. By default, a new table will use the Table Grid style, which is very plain. If your final table style requires design options like a distinctive first column or a total Row, Table Grid is a poor place to start. It doesn’t include any of those options, and adding them back in is difficult. Switch the style to a Microsoft default that already has similar features. Next, expand the table style gallery dropdown again and select New Table Style at the bottom. This ensures that your table style will appear in a new Custom row right at the top of the styles gallery. By contrast, starting with Modify Table Style lumps your style in with all the Microsoft defaults.
Base the new style on the chosen one
When you choose Table Design>Table Styles>New Table Style, Word sets the Style based on dropdown to Table Normal, not the style you chose. If you originally chose Grid Table 5 Dark, then set Style based on to the same style name. (Current versions of Word for Mac have a display bug whereby choosing a different table style does not update the preview in the dialog. Choose the style, OK out, then choose Modify Table Style to see a corrected preview.)
Word Table Style Quirks
There are some oddities about Word table styles, and a few bugs. One oddity is that table text is based on the Normal style in relationship to Word’s default text settings. If Normal has been set to any color other than Automatic, applying different text colors to different table parts will have no effect. The text will remain the color set for Normal. You then have to apply new text styles to the table parts after creating the table.
Another weird result of the dependency on Normal is that Word expects to have the default line spacing for your version of Word. As I write, Word 365’s default Normal style has a Line spacing of Multiple at 1.08 with Space After of 8 points. In a table style, this gets automatically reinterpreted as Single with 0 before and after. Centered vertical spacing then works as expected. If you change the Normal line spacing to a larger or smaller value, text that is nominally vertically centered will actually sit higher or lower in the cell. If you add 12pt after, the table text will jump from being vertically centered to having 12 pt after, a huge difference. Microsoft doesn’t publish any of this information. Surprise!
This is one of the reasons why Word experts recommend that Normal style should stay as is and not be actually used in a document unless the default formatting matches the needs of the design. Better to format all text as Body Text style and give that style the custom color and line spacing.
But what if you’re given a template that already has a non-standard Normal, and the client asks for a table style? All is not lost. Table styles can still work as designed if you are using Word for Windows (sorry, Mac people). The trick here is to set the document text defaults to the same values as the revised Normal style. (Thanks to MVP Stefan Blom for this tip.) Here’s how to do this:
With the document or template open in Word, click on the Styles pane dialog opener below the Quick Styles gallery, or press Alt + Ctrl + Shift + s at the same time. The Style pane opens.
Click on the Manage Style button at the bottom.
Select the Set Defaults tab.
Set the defaults to the same values as Normal style: same font, size, color and paragraph settings. OK out.
You’ll know you got it right when you insert a table in the new style and it automatically has the correct styling for header row, first column and the other table style options. It is no longer necessary to apply text styles to the table, you can simply turn the Table Design>Table Style Options on and off to affect the related table area.
Word Table Style Bugs
Lousy User Interface Design
In the table style dialog, color dropdowns remain set at the color last chosen, even if that was for a different table part. The dropdown should update to the color currently in use for the table part that has been selected. This is just common-sense UI design.
The interface for setting border styles is pretty bad. It’s almost impossible to set one color for vertical borders and a different one for horizontal borders. All borders switch to the last selected color. But we can fix this with an OOXML hack (see below).
Defective Override Capabilities
Subsequent parts can’t always override the XML of earlier parts. As an example, set the Whole table to have internal vertical rules. Then set the first column to have no rule on the right. This should make the vertical rule separating the first column from the second column disappear, but it doesn’t. The rule has to be manually removed after the table is created.
Non-Functional OOXML Tags
The Paragraph Properties (w:pPr) element for each table part has a pStyle attribute that is supposed to set the paragraph style for that part. It does nothing. As mentioned above, the style is always derived from Normal style.
Format the Word table style options in order.
Start by formatting the Whole table section with the defaults for cell in the middle of the preview. Most of the time, this will include the font size and color, and the table background color and any rules that are to appear if banded rows are turned off. If you can’t get the formatting you need from the few controls on the dialog, click on the Format dropdown to find detailed access to Table Properties, Borders and Shading, Banding, Font and Paragraph attributes. Under Windows, you’ll also see a Text Effects choice, which is of dubious value in a table.
Then move on to Header Row formatting, the next item on the Apply formatting to dropdown. Format each item on that dropdown until you have set all the properties you need. After you get all formatting set, apply the custom style to the sample table you created at the beginning. Then use Modify Table Style for any tweaks required.
Word Table Style Hacks
Default style formatting is hardcoded in Word. So the styles that get stored in a Word file are only styles that have been modified or newly created in the document. All of the style exceptions and new style definitions are stored in the word/styles.xml part. Here’s the OOXML for a full table style. First, the section that formats the whole table. Pr stands for Property. tbl is Table, tc is Table Cell, p is Paragraph and r is Run (any length of text less that a paragraph).
(Above) The w:rPr section sets the default text while w:tblPr sets the borders. This table is transparent when all design options are turned off, so there is no fill. Note the entries for w:insideH and w:insideV. I had to hack this XML to get different colors for the inside horizontal and inside vertical borders.
(Below) Next is the formatting for the header row. w:rPr sets the text as bold and white, while w:tcPr sets the cell borders to nothing and the fill to Accent 2.
(Above) The previous section formats the Total Row, removing the borders. There’s another hack here: the w:shd illustrates how to set the fill as No Color, with both w:color and w:fill set to auto.
(Below) Next up is the First Column formatting. w:pPr sets the text flush right, w:rPr makes it bold and w:tcPr removes the borders and keeps the fill No Color. Oddly, while w:insideH successfully overrides the internal horizontal rules set in the Whole Table section, neither w:right nor w:insideV are able to remove the internal vertical rule to the right of the column. This works as expected in a PowerPoint table style, but is broken in Word.
(Above) The right-most table column is formatted with no borders and no fill.
(Below) If your design includes banded columns, the table style will include a section like this. There is just a definition for odd columns: even columns would be formatted with the defaults from the Whole Table section. If the First Column option is turned off, odd columns start at the left-most column. If First Column is turned on, all columns shift and the column just to the right of the first column takes on odd column formatting.
(Below) Formatting for the 4 corner cells. These are only activated when both options that affect the cell are turned on. As an example, if the table has both a Header Row and a First Column, then the nwCell formatting is turned on. In the formatting for nwCell below, the text becomes flush right when both options are used.
If you base your Word table styles on a table other than Table Normal, that table style will be included in styles.xml. If that table style includes formatting that you don’t want to included in your table style, then delete the section in the style it’s based on. As an example, this style was based on Grid Table 3, which includes a last column and a total row. To remove all last column and total row formatting from your style, delete the corresponding XML sections in both your custom style and in the style on which it’s based. You’ll know when you’re succesful when turning the Last Column and Total Row Design Options on and off in Word has no visual effect on a sample table.
Too complicated? Shoot me a message and we’ll create custom Word table styles for your document or template.
I don’t actually know much, but I have search engine expertise. I’ve answered thousands of question for users on various online fora, and I’m constantly amazed by the vast number of queries that could be answered by a simple Google search. My takeaway is that people just don’t know how to use search engines to their best advantage.
Search Engine Expertise – The Mandatory Word
When a search must include a particular word or phrase, put it in double quotes, if you’re using Google. For Bing and most other engines, add a plus sign before. Here’s a search that must include Word in the results:
Google - "Word" VBA typestyle
Bing and others - +Word VBA typestyle
Search Engine Expertise – The Excluded Word
You’re looking for Word VBA information, but you get pages of useless Excel stuff. For all search engines, add a minus sign before the word you don’t want:
VBA -Excel tables
Search Engine Expertise – The Special Site
You know that you saw an answer on a particular web site, but it was a long time ago and you can’t remember where. Type your search terms, then type site:, then the site URL. No space between site: and the URL:
"edit mode of header/footer" site:answers.microsoft.com
Searching Phrases Instead of Words
Put the phrase between double quotes. The following shows results about the top of the page that don’t refer to the header and footer:
Word top part of page -"header and footer"
A Practical Example
Do you use Office for Mac? It’s hard to find relevant information, since the Mac version is still quite different from Office for Windows. Just add “for Mac” to your search terms and watch as hundreds of pages of useless Windows pages disappear. This can save you hours of time!
Using just these 4 tips, you’ll find relevant information much more quickly. You may have even more specific requirements. Check out the Advanced Search page for your preferred engine, you may find some techniques that will make your day more efficient:
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.
One of my areas of expertise is to do presentation assessments for designers, finding any potential problems in their work before sending their file to their client. Something I see fairly often is multiple slide masters in a template or theme, where they are used as an organizational tool. Typically, one master will be for title slides, another for section headers, and so on. This is a poor practice, but it goes on because designers never have to actually use the files they create. If they did, the problem would soon become evident. Here’s a typical example:
Multiple Slide Masters – How They Work
If I asked you “How does PowerPoint know which slide master to use when there is more than one?”, what would your answer be?
Well, I’ve done the research, so I can let you know. When you paste slides into a presentation, PowerPoint looks at the slide immediately preceding the paste position and uses the slide master for that slide. If there are no slides in the presentation, then PowerPoint uses the first slide master. This has major consequences for the format of the pasted slides. If the slide master of the preceding slide has only title layouts, only the pasted title slides will find their rightful layout. All the rest of the slides will bring their old layout with them. So now the slide master for titles has a whole bunch of non-title layouts. Oops. So much for your organizational scheme. Following are the original slides, followed by what they look like when pasted after slides based on different masters:
If the pasted slides are from legacy presentations, where the intention was to update them to the new look, you get a total fail. Not only do they not update, they’ve ruined the new deck with added old layouts. The next time the user adds a new slide and tries to find a layout in that slide master, they get a psychedelic soup of designs.
But wait! It gets worse! For some bizarre reason, designers have a bad habit of deleting all the placeholders on the slide master, then building the design in the layouts. Ouch! The placeholders on the slide master are parents to the child placeholders on the layouts. They are the source for font and paragraph formatting in layout placeholders, as well as the default placeholder positioning. When you paste slides so they use that blank slide master, formatting goes haywire. The slide layouts that get imported with the pasted slide have no source to tell them how to display content. PowerPoint makes a guess and always guesses wrong. Bold text becomes regular, font sizes changes, pictures disappear. It’s a nightmare, and one that designers just don’t understand, can’t explain to their clients, and have no idea how to fix.
A Better Approach
Just use a single slide master. In 99% of presentations, one slide master is all you need. That slide master should be formatted as closely as possible to look like a typical content slide. Then for layouts that have different formatting, right-click on the layout background and choose Format background. In the Format Background task pane, check the option for Hide background graphics. Then place the alternate graphics on that layout.
About the placeholders: keep them! Deleting the default placeholders does nothing helpful and can cause problems. If someone pastes a slide with a footer and your layout doesn’t have a footer placeholder, the footer text will reposition itself, often at the very left edge of the slide, because the content has been orphaned. If your design doesn’t include a footer, move the placeholder off the bottom of the layout! This makes a pasted footer simply disappear instead of looking goofy.
Multiple Slide Masters – When and How to Use Them
So far, there are only 2 uses I’ve found a genuine need for multiple slide masters. One is when a presentation requires multiple color themes. Some organizations have divisions that use code colors: a key color that is used only in that group. This situation was easier in PowerPoint 2003 and earlier, because you could easily apply different color schemes to groups of slides. Modern versions have only 1 color theme per slide master. If you change the color theme, all the slides change. Here’s how to handle that situation:
Under the slide master, create the complete set of layouts needed for the presentation. Set the code color in Accent 1 if it’s a predominant element of the client branding. If it’s a subtle design change, Accent 6 is better. Get the client to sign off, so the design is not going to need a lot of future revisions. Then copy and paste the slide master for each code color required. Finally, revise the color theme for each slide master, changing only the accent color. Following this method, every slide master has every layout. The worst that can happen is someone pastes in the wrong place and the code color is off. Easily fixed.
The other time you need multiple masters when a client has rolled out a new template, then realizes they need to handle legacy slides. Then you create a second slide master with layouts that match the new look but have a layout structure that is compatible with the old decks. At the beginning of the deck create 2 sample slides, one based on the new slide master and another based on the legacy slide master. Place a notice to the user just off the edge of the slide master for the first slide: “New slides only! Don’t paste old slides!” and on the second “Paste old slides here! No new ones!”. Then users are less likely to paste slides in the wrong spot and get weird results.
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 firstname.lastname@example.org, I’ll get you going in a jiffy.
For Office for Mac users, AppleScript remains a useful tool in scripting Office documents. VBA for Mac has poor links to the operating suystem. In Windows, a programmer can easily make system calls to the OS. In macOS, the analogous system calls are not documented by either Apple or Microsoft. A few intrepid programmers have posted about macOS equivalents, but the information is sporadic and very hard to find. macOS’s built-in AppleScript can solve many of these issues, so I’m posting the best available Office AppleScript Reference.
This is old Microsoft documentation from 2008 that they’ve removed from their site. I don’t guarantee this, or offer support, I’m just posting it to make it available to interested programmers.
Office AppleScript Reference: MacScript vs AppleScriptTask
Ron de Bruin is a European programmer and MVP (Microsoft Valued Professional) who has written lots of good information about programming Office on a Mac. While he writes mostly about Excel, VBA is so similar across Office that most of the information also applies to Word and PowerPoint. Here’s his page on using the AppleScriptTask command in Office 2016 and later to call AppleScripts from a VBA macro: AppleScriptTask in Mac Office 2016 or higher.
To create a macro that can run on different versions of Office for Mac, or on both Windows and Mac, you’ll need to use conditional compilation. This uses #If – #Else – #End if statements to run a set of commands only in certain conditions. Here is Microsoft’s page on conditional statements for different Mac versions: Differentiate between Office for Mac versions at compile time. This MS reference page shows all available conditional compiler constants: Compiler constants.
Another useful reference for AppleScript automation of Office is the online article Moving from Microsoft Office VBA to AppleScript by Paul Berkowitz. This is a full-length book with comparisons between VBA and AppleScript, plus many real-world example scripts. It was originally published in 2007, in anticipation of Office 2008. Unfortunately, the downloadable PDF they promise is no longer available.
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>
The Best Practice is to NOT use Text Effects in Office. Ever.
That could have been my shortest article ever, but I guess I should explain the reasons. I’m referring to the graduated fills and lines, the glows, reflections, shadows and 3-D effects you can add to text. In the past these effects have caused some problems with ordinary shapes, but with text, they’re a disaster.
Clearly, it’s not enough for most users that these effects are visually hideous. That just a natural result of the low value we assign to arts education. In many years of working with competent graphic artists, I’ve never been asked to create any template that uses these effects. Designers understand the need for restraint, users don’t. And so we get the appalling appearance of most Word and PowerPoint documents.
But the functional problem with these effects is how they affect PDFs created from Word, PowerPoint and Excel. Microsoft has no clue how to export true PostScript of the fancy effects. So they adopt a simplistic approach: flatten them to graphics. Unfortunately, this means the text vanishes, leaving behind only a pretty picture. Well, not even that. All kinds of PDF functions are impaired: Text to speech is impossible, accessibility goes right out the window, reimporting the PDF to Office is brain-dead.
I tested PDFs created in 3 ways: saving to PDF in Office, printing to Acrobat and printing to the Microsoft Print to PDF print driver that comes with Windows 10. When saving to PDF, all text with applied effects was flattened. When printing to either Acrobat or Microsoft Print to PDF, Gradient Fills, Gradient Lines and 3D Effects were flattened, while Shadows, Reflections and Glows remained as live text.
The moral is clear: when the client asks for Text Effects, just say NO!
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.