Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

Headers(wdHeaderFooterPrimary)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Senad Isanovic - 29 Dec 2004 13:57 GMT
Need to modify this code. I'd like the logotype to be inserted on the first
page (header) in the document only, not on the other pages. Thaks! /Senad

Sub AddLogo()

Dim HeaderRange As Range
Const BookName As String = "logotype"

Set HeaderRange = ActiveDocument.Sections(1) _
   .Headers(wdHeaderFooterPrimary).Range _
   .Bookmarks(BookName).Range

With HeaderRange
   If .InlineShapes.Count = 0 Then
       .Collapse
       .InlineShapes.AddPicture _
           FileName:="C:\bilder\al425.jpg", _
           LinkToFile:=False, SaveWithDocument:=True
       Set HeaderRange = HeaderRange.Paragraphs(1).Range
       ActiveDocument.Bookmarks.Add BookName, HeaderRange
   End If
End With

End Sub
David-RS - 29 Dec 2004 14:23 GMT
This may not be what you were looking for but instead of writing code to do
this, if you want to have the header on the first page, firstly insert a
section at the top of the document (either new or continuous), then insert
the header and on the header/footer toolbar, click the page setup icon and
goto the layout tab and make sure that the "Different First Page" check box
is selected and also the "Apply to" dropdown shows "This section".  

This way you can manipulate the headers and footers for every page if you so
wish.  This can be very useful if you want to have chapter headings.

Hope it helps

David

> Need to modify this code. I'd like the logotype to be inserted on the first
> page (header) in the document only, not on the other pages. Thaks! /Senad
[quoted text clipped - 20 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.