PowerPoint VBA add-in by
Robin Snyder
,
robin@RobinSnyder.com
, source: VITA/port-01
[NV/asp]
[page formatted/updated on 2008/11/12 at 09:07:00
, loaded on 2012/02/08 at 16:41:41
]
versions:
screen-friendly
printer-friendly
I have done VBA programming for Office applications such as Word, Excel, Access, Outlook, and PowerPoint since about 1995. This page describes a recent (volunteer) project that uses VBA in PowerPoint.
The system is about 3,000 lines of VBA code partitioned into several modules and classes.
This system is a work in progress and is improved as needed.
Here is some information about a PowerPoint VBA add-in that I created for a pastor at a local church. It allows him to easily and quickly add slides from several CD's of hymns, etc., to a PowerPoint presentation while resizing the text on the slide to make it visually easy to
see.
The problem with the CD of slides, which is a commonly reported PowerPoint issue, is that if one copy-pastes the slides, whether manually or programatically, the result is not what is desired.
The solution I adopted is to extract the content of the slides, then programatically resize the content on the new slides until the slide appears "nice". Since the author of the slides was not consistent (i.e., it appears to have been done manually) some data-scrubbing
techniques are used to make the intermediate form easily usable.
Once one can format a given shape (with text) programatically into a given region (i.e., iteratively making the font size smaller until the text fits), the problem becomes a text formatting problem - and I have a good background in text formatting solutions.
The "Hymnal" tab allows the user to type text and any title that matches that text is displayed. This makes it easy to locate the desired hymn.
Check boxes can be used to narrow the search.
All persistent settings are saved in an XML file in a folder in the "My Documents" folder. I have found using the Windows registry to be increasingly problematic as security restrictions (e.g., from Windows, firewall software, etc.) make it much easier to just put the
persistent data in a folder. Delete the folder and the application data disappears.
The "Templates" tab allows the user to specify templates for copied text (e.g., to be inserted into a Word document) and to specify text that, if on a line by itself, will be put into italics with a different font color as it is not part of the hymn.
The "Paths" tab allows the user to specify where the hymns are located and provide a way to transform the PowerPoint files into an intermediate XML format.
This cannot be done, of course, unless the user has a copy of the PowerPoint hymns (hopefully a legal copy) for processing.