PowerPoint presentation Template Designer

The PowerPoint Template Designer add-in included in 4TOPS Document Creation using Microsoft Access is fundamental to setting up the PowerPoint presentation creation process. It lets you position bookmarks representing data, tables, images, texts and more from your data source in a Word template. It communicates back to the document creation process wizard what elements of the data source are actually used, allowing the wizard to generate VBA automation code that is accurate, adaptable and fast. (Note: you can use 4TOPS Document Creation without having to see or get involved with the underlaying VBA code.)


Dim appPowerPoint As PowerPoint.Application
Set appPowerPoint = New PowerPoint.Application
Dim prs As PowerPoint.Presentation
Set prs = ppPowerPoint.Presentations.Open(FileName:=strTemplateFile)    
adding bookmarks powerpoint template designer defining the Access powerpoint presentation creation process
Use drag and drop to insert elements of the data source into the presentation.

PowerPoint presentation creation: VBA Code transferring data

When actually used, a presentation creation process picks up the display values from the relevant controls on the MS Access form or datasheet (data source). These values are then inserted in locations marked by a corresponding bookmark. In our approach, a PowerPoint bookmark is a name surrounded by square brackets.

sample VBA code that fills a document created from the template. Note the use of Word bookmark names.

Values and formatted data

When you run a document creation process the data from a form control is transferred into the new document created from the template you designed. The most basic kind of data to be is a simple value obtained from a control. However, in practice things are more complicated as in Access the developer has significant means design the application to get the user interaction with data that suit the purposes best:

  • Access forms have multiple ways to present data such as multi-column list- or combo- boxes or getting the selected value in a group box.
  • In some cases there we need to distinguish between display and bound value, e.g. in CompanyID the value could be either an ID number or the name of the company, the latter being usually more informative.
  • The display value may further be affected by a formatting expression
Having a Lookup specified causes a distinction between bound and display value

Function ControlValue

Fortunately, getting the value to be used in the Word document is much simplified by ControlValue function included in the AccessControl module inserted by the process wizard’s VBA code generator. Function ControlValue has the following interface


Public Function ControlValue(Control As Object, Optional UseDisplayValue As Boolean = True, 
  Optional Format As String = "") As Variant

This function is used with each simple data element transfer included by the wizard – on instigation of the Template Designer – in the document creation process code on e.g.


Dim pfr As New PowerPointFiller: Set pfr.Presentation= prs
pfr.FillElement Bookmark:="CustomerID", Value:=ControlValue(Control:=![CustomerID])

Bound or Display value

In the above example this would put the Company Name in the document, this having been identified as the meaningful (Display) value to identify the company using the Lookup properties.

In case we would instead want the CompanyID, we can add the UseDisplayValue function argument and assign False to it:


pfr.FillElement Bookmark:="CustomerID", Value:=ControlValue(Control:=![CustomerID], _
    UseDisplayValue:=False)

If we want both the ID and the name, the royal way is to add an extra control CustomerName to the form which gives the required extra value. This way you can add it using drag and drop in the Template Designer. The alternative would be to use Word’s Insert bookmark tool and manually add the extra line of code that uses this extra bookmark. However, using this approach can lead to loss of the extra line when you use the Template Designer (started from Manage processes) to make changes as this updates the data transfer code.

Formatting the returned value

The generated code makes it easy to apply a VBA Format expression, as commonly used with numbers and dates. Actually, this is done for you in case of fields of type date, where the formatting expression is copied from your formatting preferences. An example for text in bookmarked location in document


pfr.FillElement Bookmark:="DueDate", Value:=ControlValue(Control:=![Due Date], Format:="dd mmm yy")

or as part of the filename


strFileName = ReplaceIllegalCharacters(ControlValue(![CustomerID]), "_") & _
ControlValue(![Invoice Date], Format:="yymmdd")

Note that you are free to change the expression used in a specific line any way you like.

Inserting tables

Tables of data regularly appear in documents. To have them made available requires you to work with Access subforms. The image at the top shows control LaborLine Subform dropped on a document location. A dialog pops up allowing you to change the originally given order of columns, optionally skipping some by unchecking the column name. After insertion you can change the column names or styling, add a summary row all to your liking. Only the bookmarks indicating the first row (LaborLinesubform) and the column bookmarks (LaborLinesubform_Hours, etc.) in that row need to stay as the are used in the table filling process.

Checkboxes for Boolean data values: checked or not

When inserted using the template designer the normal interpretation is assumed, checkboxes, where True corresponds with Checked and False with Unchecked. For this inside the bookmark the ChrW(9746) symbol (False: ChrW(9744)) is used. In the wizard generated code, using the PowerPointFiller object, it is called like.


pfr.ApplyBoolean Bookmark:="Extendedservice", Value:=ControlValue(Control:=![Extended service])

Image insertion

If the field contains the name of a file (local or on the web, including http…) you can insert the data element (let’s assume it is called Image) and then alter the generated VBA code to


phtfr.InsertPicture Bookmark:="Image", Value:=Not ControlValue(Control:=![Image])

You can insert a sample image in the bookmark to show the place it will take and set its size. During insertion the replacing image will resize so that it takes the height or width, depending on the optional third MainResize argument which is of enum type dcResizeMain whose values are NoResizeResizeWidth or ResizeHeight.

Different lists representations

In the Introduction you saw a numbered list. You can fill such list your form using a subform which has only one visible column. The list can simply be altered to a bulleted list format using the Template Designer ribbon (Paragraph > Bullets), or to a text enumeration by switching to bookmarked location to a non-listed paragraph.


pfr.FillListFromArray Bookmark:="ListofReasonssubform", _
Array1D:=ValuesInSubFormColumn(control:=![List of Reasons subform], _ 
ColumnControlName:="Reason")

Access has a field type Hyperlink, e.g.  Template Designer. This is convenient, but some experienced developers think it better to avoid this and use text fields instead, e.g. https://www.4tops.com/. Anyway, both are supported here.


pfr.AddHyperlink Bookmark:="Moreinfo", _
Value:=ControlValue(control:=![More info], UseDisplayValue:=False)