Rotating a logo in header

L

Lars

Hello,

I am developing a template (Report.dot) in MS Word XP. This template
contains a macro that inserts a new page, oriented landscape. The contents of
the header and footer on this page must be rotated and re-positioned on the
right and left edge of the page (using ranges and frames) so that when the
final document is printed and assembled, all headers and footers are
consistent.

My problem is when I try to select and rotate the logos (jpeg images), I get
the following runtime error : "-2147024891 This member cannot be accessed at
this time".

The code I am using is as follows:

Dim rngHeadr As Range
Dim shpLogo As Shape

With ActiveDocument.Sections(intSectionID)
Set rngHeadr = .Headers(wdHeaderFooterPrimary).Range
End With

For Each shpLogo In rngHeadr.ShapeRange
shpLogo.Select ' <- Error occurs here
Selection.ShapeRange.IncrementRotation 90#
Next

Can anyone give me a work-around ? I will be very grateful !
 
L

Lene Fredborg

You cannot select anything in a header unless the selection is already in the
header. However, you do not need to select anything (and should not). Just
use the range object.

If you replace the following 2 code lines:

shpLogo.Select
Selection.ShapeRange.IncrementRotation 90#

with this line:

shpLogo.IncrementRotation 90#

your logo should be rotated without being selected.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
L

Lars

Hello Lene,

It works !!

Many thanks for your help. Your solution is so simple. Now that I see how it
works, I guess I was so bogged down with the different elements of ranges and
shapes that I could not see the forest, because all the trees blocked my view.

Many thanks again :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top