Insert Logo via code in a macro.

F

Fenixdood

Hey all,

I am trying to have a logo,which resides on a server here, inserted via code
into either (hopefully)a header for the document or perhaps a text box. I
only need to do this on certain merge letters ( data from access). I was
hoping I can insert into a header which I think will not skew the tables that
are within the documents. If not I will need to insert into a text box. This
project is needed since we cannot have letterhead paper for all documents..
Can any one shed some light on this .

TIA
Ron
 
J

Jonathan West

Fenixdood said:
Hey all,

I am trying to have a logo,which resides on a server here, inserted via
code
into either (hopefully)a header for the document or perhaps a text box. I
only need to do this on certain merge letters ( data from access). I was
hoping I can insert into a header which I think will not skew the tables
that
are within the documents. If not I will need to insert into a text box.
This
project is needed since we cannot have letterhead paper for all
documents..
Can any one shed some light on this .

TIA
Ron

I'll start with the obvious question.

Is there any reason why you can't insert the logo by hand into the header of
the mailmerge master document?
 
J

Jay Freedman

Fenixdood said:
Hey all,

I am trying to have a logo,which resides on a server here, inserted
via code into either (hopefully)a header for the document or perhaps
a text box. I only need to do this on certain merge letters ( data
from access). I was hoping I can insert into a header which I think
will not skew the tables that are within the documents. If not I will
need to insert into a text box. This project is needed since we
cannot have letterhead paper for all documents.. Can any one shed
some light on this .

TIA
Ron

You can use code like this to insert a picture into the main header of
Section 1 (or modify it to point oRg at some other header). Fill in the path
to the picture file on the server. You can set LinkToFile and
SaveWithDocument as necessary to control whether the picture is permanently
stored within the document file; set the Left and Top values to control the
position, and the Width and Height to control the size. It's important to
include the Anchor so the picture goes into the header and not the document
body. Choose the WrapFormat.Type to send the picture behind the text or to
wrap text around the picture.

Dim oShp As Shape
Dim oRg As Range

Set oRg = ActiveDocument.Sections(1) _
.Headers(wdHeaderFooterPrimary).Range
oRg.Collapse wdCollapseStart

Set oShp = ActiveDocument.Shapes.AddPicture( _
FileName:="\\someServer\somePath\somePicture.jpg", _
LinkToFile:=True, _
SaveWithDocument:=False, _
Left:=0, Top:=0, _
Width:=InchesToPoints(3#), _
Height:=InchesToPoints(2.5), _
Anchor:=oRg)
oShp.WrapFormat.Type = wdWrapBehind

An alternative that I would recommend before plunging into this coding
solution: It would probably be easier to create two separate main documents,
identical except that one contains the logo and the other doesn't, and
simply choose the proper document for the current merge. That way you won't
have to spend time tweaking the position and settings of the logo in code,
trying to get them right by trial and error.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
F

Fenixdood

not all letters need the logo..this is something plopped on me "the new
Guy".. you know.. dont ask how high to jump, just jump...:)
 
F

Fenixdood

I agree with your latter point Jay...trying to push that as well..but the
powers that be said to jump
 
J

Jonathan West

Fenixdood said:
not all letters need the logo..this is something plopped on me "the new
Guy".. you know.. dont ask how high to jump, just jump...:)

Put the logo in by default. Take it out just before running a mailmerge
where you are going to print to letterhead.

If necessary, you can have a button that calls a mcro which toggles the
Visible property of the logo.
 
D

Doug Robbins - Word MVP

How would your macro know which letters required the logo? If it is based
on a field in the data source, see the "Graphics from data base" item under
the "Special merges" section of fellow MVP Cindy Meister's website at:

http://homepage.swissonline.ch/cindymeister/MergFram.htm

--
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
 
F

Fenixdood

Oy,,

ok now I have a clearer picture of what is going on.. the reason we do not
want headers is because the clients here run batch letters using section
breaks.. the header would reside on all pages and they do not want that.. I
was wondering about WaterMarks..

a reason behind this is that compny letterhead is $$$ and the management
want our logo on all correspondence. But not to be plastered all over tha
place. Headers on all pages. I was asked about maybe a text box with an
inserted picture.
Perhaps someone has been in this position before and can shed some nsight on
where I should go with this..

I will forward all details if needed to obtain your help..

TIA
Ron
 

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