VBA & Macro Problems

How to Insert a Signature Image in Word Using a VBA UserForm

Phi Hung VoPhi Hung Vo Oct 23, 2026 869 views

Question details

The user wants to dynamically insert a specific director's PNG signature into a document based on the selection made in a VBA UserForm.

How to Insert a Signature Image in Word Based on a UserForm Selection
Product
Microsoft Word / WPS Writer
Device & OS
not provided
Scenario
Automating document generation where different signature images are required based on user input.
Observed behavior
The goal is to automatically place the correct signature PNG below a bookmark using an INCLUDEPICTURE field linked to a standard image path.
Before you start

Ensure you have all the director signature PNG files saved in an accessible local directory and that your document is saved as a macro-enabled format (.docm).

Solution 1Recommended

Use VBA to Overwrite an INCLUDEPICTURE Field Source

Link an INCLUDEPICTURE field to a standard temporary image path, and use a VBA macro to overwrite this image file based on the UserForm selection before updating the field.

Instead of changing the image path within the document dynamically, it is often easier to keep the document's image path static. By having your VBA code copy the chosen signature file over the static file, the document only needs to refresh its fields to display the new signature.

1
Insert the INCLUDEPICTURE field

Place your cursor where the signature should appear. Press Ctrl+F9 to create field braces. Inside the braces, type INCLUDEPICTURE "C:\path\to\standard_signature.png" \* MERGEFORMAT. Press F9 to update and hide the field code.

2
Set up the UserForm

Press Alt+F11 to open the VBA Editor. Go to Insert > UserForm. Add a ComboBox control for selecting the director and a CommandButton to apply the signature.

3
Write the FileCopy VBA code

Double-click the CommandButton to access its code. Write a script that checks the ComboBox value, defines the source path of the selected director's PNG, and uses the FileCopy command to overwrite "C:\path\to\standard_signature.png".

4
Update the document fields

At the end of your CommandButton script, add the code ActiveDocument.Fields.Update. This ensures the document refreshes the INCLUDEPICTURE field to display the newly copied signature.

Use VBA to Overwrite an INCLUDEPICTURE Field Source
File Permissions Warning: Ensure that the folder containing your standard signature path has proper read/write permissions, otherwise the FileCopy command will trigger a runtime error.
Advanced Document Automation

Automate Documents with Macros in WPS Writer

WPS Office offers robust support for VBA macros, allowing you to create custom UserForms and automate complex document workflows like dynamic signature insertion with ease.

  1. 1. Enable Developer Tools: Open WPS Writer, go to the Options menu, and enable the Developer tab to access macro and VBA features.
  2. 2. Open the VBA Editor: Click on the Developer tab on the top ribbon and select 'Visual Basic' to launch the VBA programming environment.
  3. 3. Create and Run UserForms: Design your signature selection UserForm, write your FileCopy macro script, and execute it directly within your WPS document.
Seamless compatibility with Microsoft Word macro-enabled documents (.docm).Built-in VBA editor for creating and managing custom UserForms.Lightweight, fast, and completely free to download.
microsoft office alternative - wps office

Frequently Asked Questions

Why is the INCLUDEPICTURE field not updating automatically?

Word fields do not always update automatically when the source file changes. You must either press F9 manually while selecting the field, or include ActiveDocument.Fields.Update in your VBA macro to force the image to refresh.

Can I insert the image directly without using INCLUDEPICTURE?

Yes, you can use the InlineShapes.AddPicture method in VBA to insert an image directly at a bookmark's range instead of relying on a field code. This avoids the need for a temporary standard image file.

What image formats are supported for VBA signature insertion?

Standard image formats such as PNG, JPEG, and BMP are supported. PNG is highly recommended for signatures because it supports transparent backgrounds, allowing it to blend naturally with document text.