Word Header Image - Layout Options

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,624
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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
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,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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