Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-14-2016, 06:42 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 Macro to Insert Logo in header on 1st page only and bookmark it.

Hi,

Looking for some help please... I'm trying to create a word macro which will insert a logo and address details into the 1st page header & bookmark them.
I can't use a template as we generate word documents from a DMS.

So far from using macro examples found on the internet I have...
Sub AddLogo()
Application.ScreenUpdating = False
ActiveDocument.PageSetup.DifferentFirstPageHeaderF ooter = True
Dim sh As Shape
Dim hdr As HeaderFooter
Dim rng As Range
Dim strPicture As String

strPicture = "Z:\Logo1.jpg"
For Each hdr In ActiveDocument.Sections(1).Headers
Set rng = hdr.Range
rng.Collapse wdCollapseEnd
Set sh = ActiveDocument.Shapes.AddPicture(strPicture, False, True, 0, 0, , , rng)
With sh
.Height = CentimetersToPoints(4.94)
.Width = CentimetersToPoints(3.58)
.LockAspectRatio = True
.Left = CentimetersToPoints(13.67)
.Top = CentimetersToPoints(-1.23)
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapNone


End With
Next hdr

strPicture = "Z:\Logo2.jpg"
For Each hdr In ActiveDocument.Sections(1).Headers
Set rng = hdr.Range
rng.Collapse wdCollapseEnd
Set sh = ActiveDocument.Shapes.AddPicture(strPicture, False, True, 0, 0, , , rng)
With sh
.Height = CentimetersToPoints(4.29)
.Width = CentimetersToPoints(4.84)
.LockAspectRatio = True
.Left = CentimetersToPoints(7.83)
.Top = CentimetersToPoints(-0.27)
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapNone
End With
Next hdr
End Sub

This adds a couple of logos into the header but for every page rather than the first page. I'm also not sure how to bookmark the image being added so I can hide it later on in a separate print macro.

Thanks for any help.
Reply With Quote
 



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 07:07 AM.


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