Hi,
Apologies if this is a basic question but I'm having difficult getting some VBA code to work ... I'm somewhat familiar with Excel VBA but not Word VBA, hence my lack of understanding of the required syntax. (I'm using Word 365 btw)
Basically, I have a document with a number of images that are too small on the page and I would like to select the image and run a macro to resize to 19cm width (retaining the aspect ratio) and set it as 'middle center with square text wrapping' ['position' tab of 'picture format' icon, center selection].
I have been getting near it (including unsuccessfully asking chat GPT!) but I cant seem to get it to work ... I'm regularly hanging up Word completely.
One of the Codings suggested was:
Sub ResizeAndCenterSelectedObject()
With Selection.ShapeRange
.LockAspectRatio = msoTrue
.Height = 200
.Width = 200
.Align msoAlignCenters, True
.Align msoAlignMiddles, True
End With
End Sub
I kind of got to the same area myself but this code just crashes Word (no idea why). Once I get a bit more time I will take a deep dive into Word VBA but for now, does anyone have the code to do this ... I feel it w=should be pretty short but I just don't have enough knowledge of the syntax at the moment to pull it off.
Any help appreciated
Apologies if this is a basic question but I'm having difficult getting some VBA code to work ... I'm somewhat familiar with Excel VBA but not Word VBA, hence my lack of understanding of the required syntax. (I'm using Word 365 btw)
Basically, I have a document with a number of images that are too small on the page and I would like to select the image and run a macro to resize to 19cm width (retaining the aspect ratio) and set it as 'middle center with square text wrapping' ['position' tab of 'picture format' icon, center selection].
I have been getting near it (including unsuccessfully asking chat GPT!) but I cant seem to get it to work ... I'm regularly hanging up Word completely.
One of the Codings suggested was:
Sub ResizeAndCenterSelectedObject()
With Selection.ShapeRange
.LockAspectRatio = msoTrue
.Height = 200
.Width = 200
.Align msoAlignCenters, True
.Align msoAlignMiddles, True
End With
End Sub
I kind of got to the same area myself but this code just crashes Word (no idea why). Once I get a bit more time I will take a deep dive into Word VBA but for now, does anyone have the code to do this ... I feel it w=should be pretty short but I just don't have enough knowledge of the syntax at the moment to pull it off.
Any help appreciated