Word Header Image - Layout Options

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,645
Office Version
  1. 365
Platform
  1. Windows
I have got an image in a Word Document header and I need to change the Layout Options to make it line up with an existing image in the header (on the left of the header) and some text (on the right of the header)

I can do this in Word using the following

1724065758975.png


The option that is highlighted is changed to the last option in the With Text Wrapping options.

I can't find a way of doing this in Excel VBA though

The following code inserts the picture into the header and changes the size but is is inserted in a position that needs changing which after make the Layout Option change, I can manually drag to the right position in the header.


TIA
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You haven't shared your code. Have you tried recording a macro in Word to make the alterations you want which you could then look to use in Excel.
 
Upvote 0
I managed to resolve this in the end
VBA Code:
Set rngHeader = docWord.Sections(2).Headers(1).Range

'Insert the image into the header
Set picWord = rngHeader.InlineShapes.AddPicture(strClientLogo)

'Resize the image
With picWord
   .LockAspectRatio = msoTrue
   
   .Height = 34 ' Set the height in points
   
   .ConvertToShape
   
   .Range.ShapeRange.Left = 109.6
   .Range.ShapeRange.Top = -17.55
End With

By converting the image to a shape, this allowed me to make the neccessary .left and .top changes
 
Upvote 0
Solution

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top