VBA & Macro Problems

Fix a Word Shape Fill Color Not Changing from Access VBA

Chanuka GeekiyanageChanuka Geekiyanage Nov 22, 2026 868 views

Question details

The user needs Access VBA to change the fill color of a shape in a Word document.

Fix a Word Shape Fill Color Not Changing from Access VBA
Product
Microsoft Access VBA and Microsoft Word
Device & OS
not provided
Scenario
Access VBA opens a Word document and sets a shape's fill color.
Observed behavior
The code runs without a visible change to the shape's color.
Before you start

Open the Access VBA procedure and identify the variables holding the Word application and document. In Word, select the target shape and check its name in the Selection Pane so you can reference the correct object.

Solution 1Recommended

Restore error reporting and set the correct Word shape's fill color

Use this approach when Access VBA runs without visibly changing the Word shape and errors may be suppressed.

1
Restore error handling

In the Access VBA editor, find the block that uses On Error Resume Next with GetObject or New Word.Application. Add On Error GoTo 0 immediately after that block so errors in the remaining code are reported.

2
Check the Word application

After On Error GoTo 0, check whether the Word application variable is Nothing. If it is, stop the procedure and investigate why Word could not be obtained or created before accessing the document.

3
Target the named shape

In Word, open Home > Select > Selection Pane and confirm the shape's name. In the VBA editor, use the variable for the opened document and the matching name, for example: wdDoc.Shapes("Rectangle 1").Fill.ForeColor.RGB = RGB(255, 0, 0). Replace wdDoc and the shape name with those used in your procedure.

4
Run and inspect

Run the procedure from the Access VBA editor. If an error appears, use Debug to inspect the highlighted line. In Word, verify that the displayed document and selected shape are the ones your code changed.

5
Save the change

Once the fill looks correct, save the document in Word or call wdDoc.Save using your document variable.

Restore error reporting and set the correct Word shape's fill color
Check the fill and object type: A hidden or transparent fill may not show the new color. Also, inline objects and shapes inside groups may require a different object reference than Document.Shapes("shape name").
Free Microsoft Office alternative

Edit Word Documents with WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for editing documents and changing shape formatting. Its Microsoft Office format support helps you move existing files into WPS; it does not fix Access VBA automation.

Change shape fill colors using document formatting tools.Open and edit Microsoft Word DOC and DOCX files.Use a familiar interface for everyday document editing.Work with a free, lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the VBA code run without showing an error?

On Error Resume Next suppresses subsequent runtime errors until error handling is changed. Add On Error GoTo 0 after the GetObject or New Word.Application block to make later errors visible.

How do I find the Word shape's name?

In Word, open Home > Select > Selection Pane. Select the shape and use its listed name in the document's Shapes collection.

What if the correct shape still looks unchanged?

Confirm that the code references the document displayed in Word and that the shape's fill is visible and not fully transparent. A shape inside a group or an inline object may need a different reference.

Does changing the fill color save the document automatically?

No. After checking the result, save the document in Word or call Save on the Word document variable in your Access VBA procedure.