Header image problems with Word 2000; ok in Word 2003

A

ableone

I use the code posted below to insert a large (almost full page) image
into the header of a word doc. The image is basically the letterhead of
a company. Also in the header is a table with textual information, which
must render above the background image. The image is meant to act like a
watermark, ie to be there on every page of the document.

The code works well with Word 2003, and runs without issue with Word
2000. However a document created with either version of Word does not
seem to render correctly with Word 2000. It's pretty odd, here are the
characteristics of a doc when viewed in Word 2000:

- The table and it's contained text in the header section are always
hidden behind the image. This despite the code's zorder command.

- With the header section closed, the cursor changes so that it has four
pointers, as if I'd selected an object and was supposed to be moving it
(or so I guess). However nothing I can see is selected, or moves if I
use the mouse button.

- With the header section closed, the image is not dimmed as I'd expect
it to be if it was hosted by the header. The same doc shows the image
dimmed in word 2003.

- I'm not able to select the background image with the header section
closed; OR with the header section open.

- With the header section open, the image is greyed as if it belonged to
the main doc section.

- Withe the header section open, the header table and it's text are
never visible

Again none of these oddities are apparent in Word 2003. I hope someone
can shed light on the issue with Word 2000.


Set srange = ActiveDocument.Sections(1) _
.Headers(wdHeaderFooterPrimary).Shapes _
.AddPicture(FileName:=strBasePath & strFileName)

With srange
.Name = "WordPictureWatermark1"
.PictureFormat.Brightness = 0.5
.PictureFormat.Contrast = 0.5
.LockAspectRatio = True
.Height = InchesToPoints(10.47)
.Width = InchesToPoints(8.14)
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapNone
.WrapFormat.Type = 3
.RelativeHorizontalPosition =
wdRelativeVerticalPositionMargin
.RelativeVerticalPosition =
wdRelativeVerticalPositionMargin
.Left = wdShapeCenter
.Top = wdShapeCent
.IncrementLeft -43.2
.ZOrder msoSendBehindText
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
 
A

ableone

One other aspect that's worth mentioning is when the header is closed,
and the four directions cursor is showing, the picture toolbar shows, as
if a picture was selected, and a right click shows all the picture
options like 'order', but all options are disabled.
 
A

ableone

No one has any idea about this issue?

One other aspect that's worth mentioning is when the header is closed,
and the four directions cursor is showing, the picture toolbar shows, as
if a picture was selected, and a right click shows all the picture
options like 'order', but all options are disabled.
 
J

Jonathan West

It looks like there is an error in your code. You haven't specified a Range
parameter where the shape is to be inserted. if the picture isn't being
dimmed, then it sounds very much as if it is getting anchored to a paragraph
in the main body instead of in the header. A picture in the main body is
placed over all text in the header, even if the picture's ZOrder is set to
behind text
 
A

ableone

It looks like there is an error in your code. You haven't specified a Range
parameter where the shape is to be inserted. if the picture isn't being
dimmed, then it sounds very much as if it is getting anchored to a paragraph
in the main body instead of in the header. A picture in the main body is
placed over all text in the header, even if the picture's ZOrder is set to
behind text
Thanks for looking. Doesn't this section include the needed section
info?
Set srange = ActiveDocument.Sections(1) _
.Headers(wdHeaderFooterPrimary).Shapes _
.AddPicture(FileName:=strBasePath & strFileName)

I don't really understand word's object model very well, so am not sure
if this deals with the issue you suggest.
 
D

Doug Robbins - Word MVP

The code that you were given in response to your earlier thread was

Dim myrange as Range, srange as ShapeRange
Set myrange = Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range
myrange.Collapse wdCollapseEnd
Set srange = ActiveDocument.InLineShapes.AddPicture(Filename: =
"c:\letterhead\letterhead parts\watermark.gif" _
, LinkToFile:=False, SaveWithDocument:=True, Range: = myrange)

where two range objects were being declared and the image was being inserted
into one of them (myrange)

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
A

ableone

The code that you were given in response to your earlier thread was

Dim myrange as Range, srange as ShapeRange
Set myrange = Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range
myrange.Collapse wdCollapseEnd
Set srange = ActiveDocument.InLineShapes.AddPicture(Filename: =
"c:\letterhead\letterhead parts\watermark.gif" _
, LinkToFile:=False, SaveWithDocument:=True, Range: = myrange)

where two range objects were being declared and the image was being inserted
into one of them (myrange)
Someone named Jean Marcel gave code like that for use with an inline
shape, but for a floating picture he suggested other code, which formed
the basis of the code I posted at the top of this thread. The code I
posted at the top of this thread works perfectly with word 2003, but not
with word 2000...it's what I would like to fix for word 2000, but if
anyone has another approach, fine...I just need it to work.
 
D

Doug Robbins - Word MVP

Unfortunately, like Jean-Guy, you will find that most of us have long since
moved on from Office 2000 so do not have the environment in which to test
something like this.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jonathan West

ableone said:
Someone named Jean Marcel gave code like that for use with an inline
shape, but for a floating picture he suggested other code, which formed
the basis of the code I posted at the top of this thread. The code I
posted at the top of this thread works perfectly with word 2003, but not
with word 2000...it's what I would like to fix for word 2000, but if
anyone has another approach, fine...I just need it to work.

If I recall, inserting floating shapes into headers in 2000 can be a bit
tricky, because if the header is empty, Word goes and inserts the shape into
the nearest non-empty header

So try making sure there is something - just an extra space character - in
the header before inserting the shape.

Alternativey, insert the pictuire as an InlineShape in the appropriate
header, and then use the ConvertToShape method to convert it to a floating
shape.
 

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