donnasresources@gmail.com, Author at Donna's Technology Resources https://donnasresources.com/author/donnasresourcesgmail-com/ Passionate about Excel training, automation, and Power BI Mon, 13 Apr 2020 14:02:23 +0000 en-US hourly 1 146826118 Access Concatenate Address Field Expression Code https://donnasresources.com/concatenate-address-field-expression-code/ Sat, 21 Sep 2019 01:11:14 +0000 https://donnasresources.com/?p=1427 .Use the code in this text file in Access Forms and Reports to TRIM and CONCATENATE two portions of an Address field.

The post Access Concatenate Address Field Expression Code appeared first on Donna's Technology Resources.

]]>
.Use the code in this text file in Access Forms and Reports to TRIM and CONCATENATE two portions of an Address field.

The post Access Concatenate Address Field Expression Code appeared first on Donna's Technology Resources.

]]>
1427
Useful Operators for Access Expressions https://donnasresources.com/operators-for-access-expressions/ Mon, 05 Aug 2019 03:47:31 +0000 https://donnasresources.com/?p=1414 Use these resources to learn about the large variety of useful operators that can be used when building an expression in Microsoft Access. If you do not know about these operators, you are missing out! Microsoft Table of Operators for Read More ...

The post Useful Operators for Access Expressions appeared first on Donna's Technology Resources.

]]>
Use these resources to learn about the large variety of useful operators that can be used when building an expression in Microsoft Access. If you do not know about these operators, you are missing out!

Microsoft Table of Operators for Access: breaks down the expressions into the major categories

Useful Arithmetic Operators (“+”, “-“, “* “, “/ “, “\”, “Mod”, “^”) that you should know

Comparison Operators (“<” , “>” , “=” , “<>” ,”<=”, “>=”) that you need to know

Logical Operators (“AND”, “OR”, “XOR”, “NOT”, “EQV”, “IMP”) that you must know

Handy Concatenation Operators (“& “, “+”) that you must know

The post Useful Operators for Access Expressions appeared first on Donna's Technology Resources.

]]>
1414
Captivate Software Simulation: Changing Font Color in Word https://donnasresources.com/captivate-software-simulation-demo-mode-example/ Mon, 25 Mar 2019 20:59:03 +0000 https://donnasresources.com/?p=1358 For my Captivate students, below is a sample project created the “demo” mode of the software simulation ability of Captivate. Look for use of mouse objects, text captions, and highlight boxes.

The post Captivate Software Simulation: Changing Font Color in Word appeared first on Donna's Technology Resources.

]]>
For my Captivate students, below is a sample project created the “demo” mode of the software simulation ability of Captivate. Look for use of mouse objects, text captions, and highlight boxes.

The post Captivate Software Simulation: Changing Font Color in Word appeared first on Donna's Technology Resources.

]]>
1358
Excel Skills Assessment Quiz https://donnasresources.com/excel-assessment-quiz/ Fri, 01 Mar 2019 20:37:45 +0000 https://donnasresources.com/?p=1342 Take this short 20 question Excel assessment quiz to see if you know the fundamentals of using Excel. The questions apply for all recent Excel versions. If you would like to test yourself on higher level Excel topics, take one Read More ...

The post Excel Skills Assessment Quiz appeared first on Donna's Technology Resources.

]]>
Take this short 20 question Excel assessment quiz to see if you know the fundamentals of using Excel. The questions apply for all recent Excel versions. If you would like to test yourself on higher level Excel topics, take one of the free assessment quizzes offered at Wise Owl Training.

The post Excel Skills Assessment Quiz appeared first on Donna's Technology Resources.

]]>
1342
Format Painter Tips to make it become your Excel power tool https://donnasresources.com/excel-format-painter-tips/ Sun, 24 Feb 2019 21:52:44 +0000 https://donnasresources.com/?p=1325 Are you aware of the how far you can extend the use of Format Painter as a tool in Excel?  Format Painter goes way beyond simply formatting cell properties from one cell to another cell!  Expand your use of Format Read More ...

The post Format Painter Tips to make it become your Excel power tool appeared first on Donna's Technology Resources.

]]>
Are you aware of the how far you can extend the use of Format Painter as a tool in Excel?  Format Painter goes way beyond simply formatting cell properties from one cell to another cell!  Expand your use of Format Painter with these tips so that it becomes your power tool for quick formatting consistency in Excel.

Format Painter Tip #1:  Learn the double-click mode of Format Painter

Format Painter location on the Excel ribbon for Excel Format Painter Tips at donnasresources.com
Format Painter location on the Excel ribbon

Knowing the double-click mode of Format Painter is essential for efficiency.  It allows you to be able to use this tool on multiple selections that are not or connected or “contiguous”.  Why is this mode a huge time saver?  Because single clicking Format Painter only applies formatting with one click or drag action.  If you double-click on Format Painter, it will stay on until you turn it off.  Thus, it avoids the hassle of having to turn it back on for multiple cell ranges that are non-adjacent.  When finished applying formatting in the double-click mode, simply turn it off by clicking on the Format Painter icon or by pressing Escape.

Format Painter  Tip #2:  Use Format Painter to paint properties to an entire column

Even experienced users of Excel may never discover that Format Painter can paint column properties from one column to another column.  The process is first to select the column that you want another target column to look like.   Activate Format Painter by clicking on its icon and then finish by immediately clicking on the heading letter of the target column.  Use this process to quickly match the width of one column to another column.   Or if you have a specific number format setup for a column (for example a percent style with a certain number of decimal places), paint those same properties quickly to another target column using Format Painter.

Format Painter Tip #3: Apply Format Painter across Excel sheets and Excel workbooks

A quick approach to getting an identical formatting look to other sheets and to other workbooks is to use Format Painter. To have Format Painter work across sheets, select a cell or a column that has properties that you want have on another sheet.  Then simply click or (double-click if you want to apply to multiple selections—see Tip #1) on Format Painter and immediately go to another sheet and click on your target cells or target column headings.   To have Format Painter work across files, once you activate format painter, simply go the other file if it is open or proceed to get it open.   Then use the Format Painter tool in the normal click and drag manner   Please keep in mind, however, that the best setup for maintaining the same formatting look across sheets or across files is to start using Styles. Styles offer the ability to get instant changes across sheets when you need to do any updating to the custom formatting look.   Everyone should learn how to create custom styles, modify custom styles, and merge them into other files for the ultimate setup for maintaining formatting consistency.

The post Format Painter Tips to make it become your Excel power tool appeared first on Donna's Technology Resources.

]]>
1325
Top Tips for Adobe Captivate Productivity https://donnasresources.com/top-tips-for-adobe-captivate-productivity/ Mon, 18 Feb 2019 20:16:22 +0000 https://donnasresources.com/?p=1274 Have you ever found yourself endlessly repeating the same type of revisions on multiple Captivate slides?  If so, then these top tips will come in handy for boosting your efficiency in Adobe Captivate.  If you start using them in the Read More ...

The post Top Tips for Adobe Captivate Productivity appeared first on Donna's Technology Resources.

]]>
Have you ever found yourself endlessly repeating the same type of revisions on multiple Captivate slides?  If so, then these top tips will come in handy for boosting your efficiency in Adobe Captivate.  If you start using them in the early stages of developing a Captivate project, you will make your slides come together much quicker. Another benefit is that you will achieve a much look more consistent look with minimal effort.

TIP #1:  Make global setting changes in your Captivate projects by editing the Preference settings.

How: 

Go to Edit > Preferences

Advantages:

If you make changes to these preferences when no file is open, then all new Captivate projects will have the new settings.  If a file is open, then the settings you update will only be reflected in the current file.  Some common settings to tweak are the default save locations, default slide duration (Figure 1), and default object durations.  If you are doing software simulations, then go to the Recording section.  Here you can choose default options for keyboard tap sounds, camera sounds, the video color mode, and what objects you want to be added to the stage during your recording sessions.  No longer will have to select these for each recording session.  For example, I often turn off the automatic addition of Failure captions for click boxes and text entry boxes during the Assessment Simulation mode.

Default Preference window of Adobe Captivate top tips at donnasresources.com
Figure 1: Preferences window of Adobe Captivate

TIP #2: Use the Master Slide to create Content layouts for your major slide types.

How: 

Go to Window >  Master Slide

Advantages:  

Master Slide area of Adobe Captivate showing the Main Master and the Content Masters for Adobe Captivate top tips at donnasresources.com
Figure 2: Master Slide area of Captivate showing the Main Master and the Content Masters

The Master Slide area allows you prep default content that is needed on all slides or multiple slides in your project. The top master slide on the left hand side panel is called the Main Master.  The smaller indented ones underneath it are called Content Masters (aka. second tier masters) (Figure 2).  They control the look on specific slides where they are the chosen layout.  Changes made on the top Main Master layout are automatically applied to all indented Content layouts.  For example, if a new background color is picked on the Main Master, every content layout will have that background color.  The Blank layout (Figure 2 Pt. A) operates a little bit differently than the other Content Masters. It is designed to suppress the inheritance of objects from the Main Master, so that you have always have a slide layout that truly stays blank.  For example, if the company logo is put on the Main Master, it will not be shown on the all Content Masters except the Blank content layout.

TIP #3:  Use the Object Style Manager to change the default look of slide objects.

How: 

Go to Edit >  Object Style Manager

Advantages:

Often we use the Properties Panel to customize the default look of standard objects on the stage to specific colors, fonts and font sizes that help us achieve the exact look we want.  Instead use the Object Style Manager to change the default look of objects so they immediately have the settings we want when we add them to the stage.   In Figure 3, the default look of the Text Caption style is being modified.  The Object Style Manager can also be used to create new styles with unique names by cloning a style and then renaming the clone.  Use the export and import buttons (Figure 3 Pt. A) to move styles between projects.

Alt text: Object Style Manager of Captivate showing new settings for the [Default Caption Style] for Adobe Captivate top tips at donnasresources.com
Figure 3: Object Style Manager of Captivate

TIP #4:  Use “Save Changes to Existing Style” to quickly update the style that you have customized on the stage

How:   

After you make a customization to the look of an object on the stage, go to the Properties panel. Click on the tiny menu button next to Style Name (Figure 4 Pt. A).  In the drop down menu that appears, select “Save Changes to Existing Style” (Figure 4 Pt. B).

Advantages:

Showing location of “Save Changes to Existing Style” in the Properties Panel for Adobe Captivate top tips at donnasresources.com
Figure 4: Location of “Save Changes to Existing Style” and “Reset Style” in the Properties Panel

By selecting, “Save Changes to Existing Style”, the style of that object is updated without even having to go to the Object Style Manager (see Tip #3).  As a result, the look of that particular object will be automatically changed throughout the project.  Additionally any time a new instance of that object of that type is added to the stage it will be ready to go with the desired look.  However, please be aware that this action may not affect individual objects whose styles have already been customized using the Properties panel.  This is because direct formatting edits are considered style overrides.  A quick way to know if a style is in an overridden state, is to see if the style name listed in the style name box start with a plus (+) followed by the style name.  To update such overridden objects, select the object and click “Reset Style” in the Properties panel (Figure 4 Pt. C).

TIP #5:  Create  and Share Custom Themes

How: 

Go to Themes  > Save Theme As…

Advantages:

Theme menu showing a new custom Theme called DonnasResources for Adobe Captivate top tips at donnasresources.com
Figure 5: Theme menu showing a new custom Theme called DonnasResources

Themes help you get a consistent design. Themes contain master slide layouts, object styles, skin and TOC settings, and recording defaults.  When you start a project, you are using the default theme.  In a normal install of Captivate it is called the “White” theme.  Captivate provides a few more additional built-in themes under the Themes drop down menu on the toolbar.    Use these built-ins as a starting point and then make modifications to your liking in the Master Slides area (Tip #2), in the Object Style Manager (Tip #3), in the color set and in your TOC setting and recording defaults.  Save your modifications as a custom theme with a unique theme name by going to Themes >  Save Theme As.  The file extension of a theme file is cptm.  Once created, your custom theme will be viewable under Themes drop down list on the main toolbar to reuse on multiple projects (Figure 5).  If a colleague needs to use the custom theme you created, save the theme to a shared location and then tell your colleagues can browse to the theme from the Theme drop down.  Another bonus of themes is that Captivate makes it extremely easy to switch themes in the middle of a project just by applying a new theme.

TIP #6:  Create  and Share Template files

How: 

Go to Save As >  Save as type: Captivate Template File (*.cptl)

Advantages:

Templates help you start a project with prefilled in slide content, already imported media, and ready to go Advanced Action scripts, and question pools.  Create templates when you need a particular framework for your course setup.  For example, maybe you need some common slides to use in multiple courses or you have a navigation menu that cannot be placed on Master Slides.  Since Themes live inside template files, it is a good idea that before you save and share a template file to have created a Custom theme inside it.   The extension of a Captivate template file is cptl.

Templates must be chosen at the start of a Captivate file.  Choose File > New Project >  Project from Template and then navigate to the template file.    The template file will open with an unsaved name of Untitled1.cptx.  Save as you normally would with a unique name to that particular project. 

The post Top Tips for Adobe Captivate Productivity appeared first on Donna's Technology Resources.

]]>
1274
Field Validation Rules For Access Table Data https://donnasresources.com/field-validation-rules-for-access-table-data/ Mon, 11 Feb 2019 04:47:06 +0000 https://donnasresources.com/?p=1255 Field validation rules can help make sure that data you enter into Access tables has correct form and/or meets certain requirements.  Validation rules prevent bad data from being entered by restricting user input. A couple of key things need to Read More ...

The post Field Validation Rules For Access Table Data appeared first on Donna's Technology Resources.

]]>
Field validation rules can help make sure that data you enter into Access tables has correct form and/or meets certain requirements.  Validation rules prevent bad data from being entered by restricting user input.

A couple of key things need to be considered when adding field validation rules.  First, think about adding “OR IS NULL”  to your rule.  With this addition, you will have the added benefit of still being allowed to leave the field blank.  Otherwise, you may find that you cannot leave the field empty once the validation rule is setup.  Another key tip is to consider thoughtfully about whether your validation rule covers 100% of the cases that can be dreamed up.  If your validation rule falls short of handling all cases, then do not add that particular validation rule as it cannot be bypassed once in operation.  A better alternative route would be to add an event to your form that gives a heads-up warning that some criteria may not be met for a particular field.

How to enter a Validation Rule:

The easiest place to set them is in table design view.  Enter the rule using the Validation Rule box found in the lower half.   Validation rules can also be added into the Property Sheet when in datasheet view.

Example Validation Rules for Fields:

This table provides some useful example of field validation rules.  See this post for more examples.

Validation Rule for Field Restriction Set
Is Null OR >=0 Must be a positive number or zero
Is Null OR Between 0 and 1 Values greater than 100% (100% is 1) not permitted
Is Null OR Between 10000 and 99999 Exactly 5 digits (numbers input) required
Is Null OR Like “#####” Exactly 5 digits (text input) required
Is Null OR “P” or “F” Must choose between P (part-time) or F (full-time)
Is Null OR <= Date() Future dates not permitted
Is Null OR Between #2000-03-14# And Date() Must enter a date between March 3, 2000 and today’s date
Is Null OR ((Like “*?@?*.?*”) AND  (Not Like “*[ ,;]*”)) Email address format required  (Must be at least one character, @, at least one character, dot, at least one character. Space, comma, and semicolon are not permitted.)
Is Null OR Like “SKU[0-2]####[ABC] Specific product code format required (Must start with SKU followed by five-digit numbers and then the letter A, B, or C. The first digit must be 0, 1, or 2.)

The post Field Validation Rules For Access Table Data appeared first on Donna's Technology Resources.

]]>
1255
Branding your SharePoint site with an alternate style sheet https://donnasresources.com/branding-your-sharepoint-site-with-an-alternate-style-sheet/ Tue, 22 Jan 2019 00:16:37 +0000 https://donnasresources.com/?p=1079 Maybe the out-of-the-box composed looks that give you new look with “one click” (Site Settings > Look and Feel > Change the look) just don’t give you enough choice for brand customization. And maybe you just don’t want to spend Read More ...

The post Branding your SharePoint site with an alternate style sheet appeared first on Donna's Technology Resources.

]]>
Maybe the out-of-the-box composed looks that give you new look with “one click” (Site Settings > Look and Feel > Change the look) just don’t give you enough choice for brand customization. And maybe you just don’t want to spend time to learn the complicated process necessary for modifying the .spcolor and .spfont files that drive these composed looks to enter your own exact branding parameters. If so, then this relatively simple method for achieving exact branding settings on your site is for you!

This method helps you achieve your branding look through the creation of a new style sheet in the Assets Directory and telling your SharePoint site to use this sheet as an alternate CSS sheet. After that is set up, snippets of CSS code in operation are copied to your style sheet using Code Inspector as your investigative tool. These snippets are then modified to your exact branding specifications.

Step 1:  Create a new alternate CSS style sheet:

  1. Open your site using SP Designer.
  2. Click on Site Assets (A) on the left hand side menu.
  3. Use the Asset (B) button located on the Ribbon to choose CSS (C) file.
  4. Give this new CSS file a meaningful name.
Figure 1: Starting a new style sheet with SharePoint Designer

Step 2:  Attach this new style sheet to your site:

  1. From the gear menu of your SharePoint site, select Site Settings.
  2. Under the “Look and Feel” category on the right, choose Master Page.
  3. Scroll to the bottom section for setting an Alternate CSS URL.  Select Specify a CSS file to  be used for this site and all sites that inherit it.  Then Browse to the style sheet file you created in Step 1.
Specifying an alternate CSS file in SharePoint at donnasresources.com
Figure 2: Specifying an alternate CSS style sheet

Step 3:  Add styles to the style sheet:

  1. On your site in the browser, hover over the element of which you would like to modify properties.
  2. Right click and choose Inspect Element.
  3. The lower half of your screen opens up the Code Inspector.  The CSS is on the lower right hand side. When you find the style you wish to modify, go to the small expand/collapse arrow on the left of that style group, right click on it and choose Copy Rule.
  4. Go to SharePoint Designer and paste this code into your CSS file. Then modify specific CSS attributes as needed.
Using code inspector to see the CSS in operation on a SharePoint element
Figure 3: Where to right click in Code Inspector so you can copy the CSS in operation

Example 1: Change font

To change the font, copy the group of CSS that contains the font-family attribute that comes first in the code inspector. Paste that line of code into the CSS file. Modify it by adding your desired font as the first font listed in the font-family list.

For example, if you want Garamond font, modify the CSS copied from font-family line (as shown in Figure 3) to look like this:

font-family: Garamond, “Sego UILight”, “Segoe UI”, “Segoe”, Tahoma , Helvetica, Arial, sans-serif;

Example 2: Add a Background Image

To add a background image to your page, first add the image to your Site Assets either through the regular browser interface or through SharePoint Designer.

Then type in your style sheet this line of CSS in a new line. Substitute Tulips.jpg with the exact name of your image file you added to your site assets.

.ms-backgroundImage                  {

                                background-image: url(‘Tulips.jpg’);

                                }             

The post Branding your SharePoint site with an alternate style sheet appeared first on Donna's Technology Resources.

]]>
1079
How to create a Word letterhead template with new page settings on Page 2 https://donnasresources.com/how-to-create-a-word-letterhead-template-with-page-setting-changes-on-page-2/ Tue, 23 Oct 2018 03:52:09 +0000 http://donnasresources.com/?p=546 Often company letterhead templates are designed to contain pre-filled header and footer content with a company logo, sample starter text, and custom page settings like margins.  These templates are typically no more than 1 page long since limited content is pre-typed Read More ...

The post How to create a Word letterhead template with new page settings on Page 2 appeared first on Donna's Technology Resources.

]]>
Often company letterhead templates are designed to contain pre-filled header and footer content with a company logo, sample starter text, and custom page settings like margins.  These templates are typically no more than 1 page long since limited content is pre-typed in the body.  A particular dilemma that may stump you is how to have different settings on Page 2 and all subsequent pages.   For example, you might like page numbers to be visible starting with Page 2.  You cannot rely on the standard method of checking the box for “Different First Page” for the new header and footer content because you don’t have a Page 2 in the template.  Another dilemma is figuring out how to set a new margin settings for Page 2 and beyond.  If you use your “standard go to method” of changing margins by adding a section break, the end user may not know how to work with the section break and they may inadvertently delete it.  To implement both of these types of setting changes as text spills beyond Page 1, I am going to show you some simple work-a rounds.

How to change template Header & Footer content for Page 2 and beyond:

To have different Header & Footer content for page 2 and beyond, the technique is pretty straight forward.  Just add enough placeholder content to generate page 2 and turn on the “Different First Page” checkbox.  Luckily, once you proceed to set different content for the  header and footers content of Page 1 and Page 2 and then, delete the placeholder content in the main body to get back to one total page of content, Word remembers the new Page 2 Header and Footer settings when the template  content reaches two page length or more.

The specific steps are as follows:

  1.  Add enough dummy content to the body of the document so that Page 2 is created.  A quick way to do this is by typing in =rand(8,6) followed by hitting enter.  This creates 8 paragraphs of random text with 6 sentences in each paragraph.
  2. Click into the Header.  Put a check-mark in the Different First Page checkbox.
  3. Add the Header and Footer content  desired for Page 1. For example,  add company logo, company name, and address,
  4. Add the Header and Footer content desired for Page 2.  For example,  add page numbers to the footer.
  5. Delete the dummy placeholder text.
  6. Do a quick test by adding dummy placeholder text back in to see if Word retains the knowledge of different Header and Footer content for Page 2 and beyond.

How to make template Page Margins different on Page 2 and subsequent pages:

The workaround to get a different top margin on Page 2 and beyond is pretty slick.  The top margin for Page 2 and subsequent pages will be controlled by the Margin settings set for the overall document on the Layout tab.  The top margin will be different on Page 1 by using the trick of adding a text box to Page 1 header.  This text box forces the body text to start lower on Page 1, thus in effect giving “the look” of a bigger top margin on Page 1.

Use these steps to accomplish this:

  1. Complete the steps #1-5 in the previous section because it is important to have the setting of Different First Page turned on.
  2. Change your document margins to what you want for Page 2 and beyond by the normal method of going to the Layout tab and clicking on the Margins button.  Select either a built-in set of margins or go to Custom Margins and set the particular ones you want.
  3. Go to the Header of Page 1.  Add a Text box to the header that has a Wrap Text setting of “Top and Bottom”.  Set its width to around 8.5″.  Give the text box a height that makes it block enough of the upper region of the page so that the typing of the text in the body is exactly where you want the text for Page 1 to start.  Finish by making the text box hidden by removing its outline/border.  Choose a fill color of “No Fill” so any graphics behind it will be seen.Text Box added to header to make page one margins bigger at donnasresources.com

The end result is that you have sneakily used the text box to falsely create the look of a bigger top margin on Page 1.

 

Related Posts

Dynamic Mail Merge to Capture Excel Formatting

 

 

The post How to create a Word letterhead template with new page settings on Page 2 appeared first on Donna's Technology Resources.

]]>
546
Using VBA to insert header and footer images in Word document Letterhead Templates https://donnasresources.com/using-vba-to-insert-header-and-footer-images-in-word-document-letterhead-templates/ Sat, 13 Oct 2018 20:19:55 +0000 http://donnasresources.com/?p=973 A company that was rebranding approached me with the desire to create one universal letterhead template file that would work for all office locations.  When the file opened, they wanted a prompt to ask the end user which office they Read More ...

The post Using VBA to insert header and footer images in Word document Letterhead Templates appeared first on Donna's Technology Resources.

]]>

A company that was rebranding approached me with the desire to create one universal letterhead template file that would work for all office locations.  When the file opened, they wanted a prompt to ask the end user which office they would like to create a letterhead document.  The end user selection then was to be used to populate specific office information such as address and phone numbers in the header and footer areas.  This task was first solved by using Visual Basic (VBA) inside Microsoft Word to create a user form with controls that are mapped to specific bookmarks in the template.  But this working solution ran into issues with the client’s desire to have direct control over fine-tuning the exact placement of the text and its font characteristics such as size and boldness.  They didn’t want to have to modify the VBA code whenever they wanted tweaking done.  Thus, the solution was changed to using VBA to insert images of the header and footer information instead of using VBA to place textual information.  This way modification of the template could be done in-house by the graphics department.  Simply by having graphics provide refreshed image files the template would be updated through the dynamic use of the user form pulling in the new images.

The approach I used can be broken down into these major steps:

  1. Create your header and image files and place them in a folder called Images.
  2. Create a source Word document containing a table of the office location names and the names of the header and footer image files.
  3. Set bookmarks in the template file to indicate where the images are to be placed in the document.
  4. Code a user form box to pull the office information from the source table and display that in a simple window as the template file opens.
  5. Write VBA code to take the input from the user form box and place the appropriate image files at the correct bookmarks.
  6. Scale the images to the appropriate magnification level by using scaling commands in the VBA code.

Each of these steps is detailed below.

Step 1:  Create header and footer image files and place them in a folder called Images

Use a graphic program to create your image and footer image files.  I made my images 8.5” inches wide.  As for the length, I made them as tall as the top margin setting for the header files and as tall as the bottom margin for the footer files.  Place all these images in a folder called Images.  Store this image folder in the same folder as the sourceaddresses.docx file created in Step 2 and the letterhead template file created in Step 3.

Step 2: Create a source Word document containing a table of office location names and the names of the header and footer images

Create a new word document called SourceAddresses.docx.  Insert a table containing office location names and the names of the header and footer images.  Make sure the table has a header row indicating the content of each column.  The table information will be read by the VBA.  For the code I have shared in this post, have column 3 and column 4 contain the names of header images and footer images, respectively. Any other content in the document, besides the table area, will be skipped so if you want to type a title for the table and other notes below, it will not impact the VBA code being able to read the table of information.

Example of Source addresses file where information is typed in a table format at donnasresources.com

Step 3: Set bookmarks in the template file to designate where the images are to be placed

3a. Setup Word options so that you can see the bookmarks you will set:

Dialog box in Word where you can turn the showing of bookmarks at donnasresources.com

By default Word will keep bookmarks hidden.  Do these steps, so

you can see where they are set:

  1. Open your template file and save it as a Macro-Enabled template (*.dotx).
  2. Click on the File tab and then choose Options.
  3. Go to the Advanced category on the left hand side.
  4. In the Show Document Content section, put a checkmark in the Show Bookmarks box.  Now bookmarks inserted in the document will be seen by an I-beam symbol.

3b. Insert a bookmark called BkmHead in the very upper left corner of header by these steps:

  1. Double click within the top 0.5” of the document to get into the Header area
  2. Move your cursor all the way to edge of the piece of paper by moving your left indent markers all the way to the edge of the paper.  If you have standard 1” margins then you can also do this by entering -1.0 in the left indent box on the Layout tab.
  3. In the Header from top box enter a value of 0”.  Your cursor should now be in the very upper left corner of the document.
  4. Click on the Insert tab and then on Bookmark.  Add a bookmark with the name BkmHead.  You should now see the header bookmark at position A

3c. Insert a bookmark called BkmFoot in the very lower left corner of footer by these steps:

  1. Get your cursor in the Footer area.
  2. Move your cursor all the way to edge of the piece of paper by moving your left indent markers all the way to the edge of the paper.  If you have standard 1” margins, then you can also do this by entering -1.0 in the left indent box on the Layout tab.
  3. In the Footer from bottom box enter a value of 0” Your cursor should now be in the very bottom left corner of the document.
  4. Click on the Insert tab and then on Bookmark.  Add a bookmark with the name BkmFoot.  You should now see the footer bookmark at position B.

Placement of the bookmarks for VBA to use at donnasresources.com

Step 4:  Create a VBA user form to read the office information and display it to end user

A great guide to help me get started was found in a similar project on tech republic

4a:  Create the userform

  1. Open VBA editor by pressing [Alt] + [F11]
  2. Then go the Insert menu and choose UserForm.  The toolbox should automatically be displayed.  If you do not see it then choose Toolbox from the View menu.
  3. Add  a list box and a command box control to the userform and make them the desired size.
  4. Name the list box and the command box by using the name box in Properties window.
  5. Use the Caption box in Properties window to give the user form and the command button user friendly verbiage.  For example, for the user form  enter a Caption of something like “Select your office” and for the Command button enter a caption of “OK”.User form controls to add at donnasresources.com

4b:  Add the code to have the userform read the table of addresses display it in the userform:

Double-click the userform to return to its module and then enter the following code which stores the table information in an array and then populates the array information in the userform:

Private Sub UserForm_Initialize()
Dim arrData() As String
Dim sourcedoc As Document
Dim sourcename As String
Dim I As Integer
Dim j As Integer
Dim myitem As Range
Dim m As Long
Dim n As Long
  Application.ScreenUpdating = False
  
  'Code opens the file called Sourceaddresses.docx and reads the contents
  'Note:  The file SourceAddresses.docx must be located in the same files as this template file.  Never move or rename it.
   Set sourcedoc = Documents.Open(FileName:=ThisDocument.Path & "\SourceAddresses.docx", Visible:=False)
    
  'Get the number of list members (i.e., table rows - 1 if header row is used)
  I = sourcedoc.Tables(1).Rows.Count - 1
  'Get the number of list member attritbutes (i.e., table columns)
  j = sourcedoc.Tables(1).Columns.Count
  
  'Set the number of columns in the Listbox
  ListBox1.ColumnCount = j
  
  'Load list members into an array
  ReDim arrData(I - 1, j - 1)
  For n = 0 To j - 1
    For m = 0 To I - 1
      Set myitem = sourcedoc.Tables(1).Cell(m + 2, n + 1).Range
      myitem.End = myitem.End - 1
      arrData(m, n) = myitem.Text
    Next m
  Next n
  
  'Use the .List property to populate the listbox with the array data
  ListBox1.List = arrData
  'Close the source file
  sourcedoc.Close SaveChanges:=wdDoNotSaveChanges
lbl_Exit:
  Exit Sub
End Sub

4c:  Add the code to run the userform automatically:

Open ThisDocument module from the Project Explorer window.   Enter and save these short lines of code.  This will make the userform appear upon the opening of the template file.

Sub AutoNew() 
UserForm1.Show 
End Sub

Once you have added this code, save and close the template file.  Then double-click on the template file to see if the userform works.  The userform should look something like this.

example of a userform box populated with information by VBA at donnasresources.com

Step 5:  Write VBA code to place the images at the appropriate bookmarks

Open VBA editor by pressing [Alt] + [F11].   Go to Userform1 and  add the lines of code below underneath the lines of code that you added in Step 4b above.

This code places the image files at the bookmarks set in the Header and the Footer. The very bottom section of the code is also necessary to change to print layout view (default view) and to force the cursor to be located in main document.  These additional steps are necessary because insertion of the bookmarks is in the Header and Footer area leaves the cursor in that location for the end user.

Private Sub cmdOK_Click()

' Dim header_image As String
' Dim footer_image As String

Dim header_image As String
Dim footer_image As String
'
'
' 'Load the option selected in the listbox and delete return characters unless they are in the address field
If Not IsNull(ListBox1) Then

header_image = Me.ListBox1.Column(2)
header_image = Replace(header_image, Chr(13), "")
footer_image = Me.ListBox1.Column(3)
footer_image = Replace(footer_image, Chr(13), "")

Dim BmkNm As String

' PLACE HEADER IMAGE at the bookmark called "BkmHead" and scale it to make it the desired size
BmkNm = "BkmHead"
With ActiveDocument
If .Bookmarks.Exists(BmkNm) Then
Dim WrdPic As Word.InlineShape
Set WrdPic = .Bookmarks(BmkNm).Range.InlineShapes.AddPicture(ThisDocument.Path & "\Images\" & header_image, False, True)

With WrdPic
.ScaleHeight = 84
.ScaleWidth = 84
End With
End If
End With

' PLACE FOOTER IMAGE at the bookmark called "BkmFoot" and scale it to make it the desired size
BmkNm = "BkmFoot"
With ActiveDocument
If .Bookmarks.Exists(BmkNm) Then
Set WrdPic = .Bookmarks(BmkNm).Range.InlineShapes.AddPicture(ThisDocument.Path & "\Images\" & footer_image, False, True)

With WrdPic
.ScaleHeight = 84
.ScaleWidth = 84
End With
End If
End With
'
'
'
'CHANGE TO PRINT LAYOUT VIEW & FORCE CURSOR TO BE IN MAIN DOCUMENT
ActiveDocument.ActiveWindow.View = wdPrintView
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If

Unload Me

Selection.HomeKey Unit:=wdStory
End If

End Sub

Step 6: Scale the images to the appropriate magnification level by using scaling commands in the VBA code.

Before you do this final step, open the template file to see if it successfully places the image files in the header and footer.  The code should work well except you will probably notice that the images are too small.

So the next step is to adjust the .ScaleHeight and .ScaleWidth properties to appropriate values so that the image will have the right dimensions.  The easiest way to do this is by reading the dimension of the image placed into Word in inches.   Then think about the desired width you would like your image to be in Word.   Adjust the..ScaleHeight and .ScaleWidth by the ratio of the desired width over the current width.  When working with my images I created them to span the width of the document so I wanted them to be 8.5” wide. I adjusted ScaleWidth and ScaleHeight to values that got me a width of 8.5″.

Sample Files to Download:

Feel free to download my set of sample files.  After extracting them, open the file called LetterheadTemplatefor AllOfficeLocations.dotm.   Images will placed in the both the Header and Footer areas per the end user’s request.  If you chose Location C, the document generated will look like this.

example of finished project showing placement of images at donnasresources.com

If you find this post helpful, be sure to leave a comment.

Thanks.

The post Using VBA to insert header and footer images in Word document Letterhead Templates appeared first on Donna's Technology Resources.

]]>
973