I’m trying to write a very basic macro in VB for Microsoft Word, but I don’t have the required knowledge.
I simply need to do two things:
- Insert a picture from file
- Relocate it to the top right corner and resize it
I can do the first task via the record new macro feature but I am unable to select move a picture while in recording mode so I need some VB code for this.
I already have this, so how do I move/resize the image?
Selection.InlineShapes.AddPicture FileName:= _
"C:\Users\***\Pictures\**.jpg" _
, LinkToFile:=False, SaveWithDocument:=True
The AddPicture function has a number of parameters which include width and height which you can use to resize the image to the desired size.
Please see an example below:
Additionally, have a look at this msdn article for an explanation of the AddPicture() function as well as the list of available parameters which you can pass to it.