How to Fix Invalid Use of Property for Word VBA InlineShape ScaleHeight
Question details
The user needs to resolve an 'invalid use of property' error when attempting to set the ScaleHeight and ScaleWidth of an InlineShape in Word VBA.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Writing or executing a VBA macro to resize an inline shape in a Word document using VBA code.
- Observed behavior
- Word VBA throws a compile or runtime error stating 'invalid use of property' when using method-style syntax (parentheses) to pass values to ScaleHeight or ScaleWidth.
Ensure you have the Developer tab enabled in your Word application and can access the VBA Editor (Alt + F11) to modify your macro script.
Assign Values Directly as Properties
Change the code syntax from a method call (using parentheses) to a direct property assignment (using the equals sign).
In Word VBA, ScaleHeight and ScaleWidth are defined as Single properties of the InlineShape object, not as methods. Attempting to pass arguments in parentheses triggers the 'Invalid use of property' compile error.
Press 'Alt + F11' on your keyboard to open the Visual Basic for Applications (VBA) Editor.
Find the line of code that looks similar to: Selection.InlineShapes(1).ScaleHeight(60) or Selection.InlineShapes(1).ScaleWidth(60).
Remove the parentheses and use an equals sign to assign the value. Change it to: Selection.InlineShapes(1).ScaleHeight = 60.
Ensure ScaleWidth is also updated to use the equals sign: Selection.InlineShapes(1).ScaleWidth = 60.
Press 'F5' or click the 'Run' button on the toolbar to execute the updated macro. The shape should now resize without throwing an error.

Verify Object Model Differences Between Excel and Word
Ensure the VBA code is adapted for Word's specific object model if the code was copied from an Excel macro.
Run and Edit VBA Macros Seamlessly in WPS Office
WPS Writer offers robust support for VBA macros, allowing you to easily run, edit, and debug scripts for automating document formatting and resizing inline shapes.
- 1. Open your macro-enabled document: Launch WPS Writer and open your .docm or .doc file containing the VBA macros.
- 2. Access the VBA Editor: Navigate to the 'Developer' tab on the ribbon and click 'Visual Basic' or press 'Alt + F11'.
- 3. Edit the InlineShape properties: Locate your macro code and update the ScaleHeight and ScaleWidth syntax to use the equals sign assignment.
- 4. Execute the macro: Click the 'Run' icon or press 'F5' within the WPS VBA Editor to apply your changes to the document.

Frequently Asked Questions
What does 'Invalid use of property' mean in VBA?
This error occurs when you attempt to use a property as if it were a method (e.g., passing arguments inside parentheses instead of using an equals sign to assign a value), or when you try to assign a value to a read-only property.
Why does my Excel VBA shape-resizing code fail in Word?
Excel and Word use different object models. Excel primarily handles floating shapes on a Worksheet, while Word distinguishes between floating Shapes and InlineShapes (shapes embedded in the text layer). The properties and methods for manipulating them are not identical.
How do I resize all images in a Word document using VBA?
You can use a 'For Each' loop in VBA to iterate through all images. For example: Dim shp As InlineShape; For Each shp In ActiveDocument.InlineShapes; shp.ScaleHeight = 50; shp.ScaleWidth = 50; Next shp. This will scale all inline shapes to 50%.




