Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-14-2016, 04:10 PM
macropod's Avatar
macropod macropod is offline Macro to Insert Logo in header on 1st page only and bookmark it. Windows 7 64bit Macro to Insert Logo in header on 1st page only and bookmark it. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,512
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can't bookmark a shape object. You might bookmark its anchor but, better still, if you name the shape, you can use the name for future reference.


Code:
Sub TITLE()
Application.ScreenUpdating = False
Dim Shp As Shape
With ActiveDocument.Sections(1)
  With .PageSetup
    .DifferentFirstPageHeaderFooter = True
    .TopMargin = CentimetersToPoints(5)
  End With
  Set Shp = .Headers(wdHeaderFooterFirstPage).Shapes.AddPicture _
    (FileName:="Z:\Logo1.jpg", LinkToFile:=False, SaveWithDocument:=True)
  With Shp
    .Height = CentimetersToPoints(4.94)
    .Width = CentimetersToPoints(3.58)
    .LockAspectRatio = True
    .Left = CentimetersToPoints(13.67)
    .Top = CentimetersToPoints(-1.23)
    .WrapFormat.AllowOverlap = True
    .WrapFormat.Side = wdWrapNone
    .Name = "Logo1"
  End With
  Set Shp = .Headers(wdHeaderFooterFirstPage).Shapes.AddPicture _
    (FileName:="Z:\Logo2.jpg", LinkToFile:=False, SaveWithDocument:=True)
  With Shp
    .Height = CentimetersToPoints(4.29)
    .Width = CentimetersToPoints(4.84)
    .LockAspectRatio = True
    .Left = CentimetersToPoints(7.83)
    .Top = CentimetersToPoints(-0.27)
    .WrapFormat.AllowOverlap = True
    .WrapFormat.Side = wdWrapNone
    .Name = "Logo2"
  End With
End With
Set Shp = Nothing
Application.ScreenUpdating = True
End Sub
PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 09-15-2016, 03:46 AM
youseeme youseeme is offline Macro to Insert Logo in header on 1st page only and bookmark it. Windows 10 Macro to Insert Logo in header on 1st page only and bookmark it. Office 2013
Novice
Macro to Insert Logo in header on 1st page only and bookmark it.
 
Join Date: Sep 2016
Posts: 6
youseeme is on a distinguished road
Default

That's great, thank you macropod, will use the # in future.

It turns out then inserting text as a picture file loses quite a bit of quality in the image, so when it prints it looks pretty bad.
Instead of inserting a picture using this method is it possible to insert a text box with text in it into the header and position it accordingly?

Thanks again.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Insert Logo in header on 1st page only and bookmark it. Macro to insert Landscape page Catty Word VBA 1 05-05-2014 03:42 AM
Macro to Insert Logo in header on 1st page only and bookmark it. Open header to insert text into bookmark Amapola188 Word VBA 3 07-12-2012 05:16 PM
Macro to insert new page... samanthaj Word 17 01-31-2012 01:53 PM
Macro to Insert Logo in header on 1st page only and bookmark it. Macro to get first letter of a page in the header faramir Word VBA 4 11-16-2011 05:43 AM
Macro to Insert Logo in header on 1st page only and bookmark it. How to print header logo only in 1st page Shafraz Khahir Word 1 11-29-2010 11:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft