Is there a way I can resize an image in a MS word doc to be 'maximised'?

Hey,

I’m currently facing an automation problem where I need to have an image in a word document, which I am doing with with the Word Application Scope.

The issue I’m facing is that when I insert it, it’s a tiny little image just placed in the top (or wherever I select) of the the document and ideally I need it to cover the entire document as if it’s ‘maximised’.

Is there any way I can do this? Preferably I’d rather the bot didn’t have to manually open the document and do something with it, but if that’s the only option then I suppose its worth hearing.

Thanks for your help.

Yes, you can create a VBA macro for this, but it requires the Word document to be saved in the .docm format to support macros. Alternatively, you can create the macro in Excel, which dynamically launches Word and performs the required actions.
(You can ask for ChatGPT to create in above manner)

Hi @dr1992,

To insert an image that covers the entire Word document page using UiPath:

Default insert: Image is small and positioned where inserted.

UiPath Word activities don’t support auto-resizing to page size directly.

Quick Solutions:
Invoke VBA inside Word Application Scope
Run VBA code to insert and resize the image to page dimensions, e.g.:

Set shape = ActiveDocument.InlineShapes.AddPicture(“C:\image.jpg”)
shape.Width = ActiveDocument.PageSetup.PageWidth - ActiveDocument.PageSetup.LeftMargin - ActiveDocument.PageSetup.RightMargin
shape.Height = ActiveDocument.PageSetup.PageHeight - ActiveDocument.PageSetup.TopMargin - ActiveDocument.PageSetup.BottomMargin

Pre-resize the image to page size before inserting.

Manual UI automation opening Word and resizing (least recommended).

Happy Automating!
AJ