--
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
"Brandon M. Hunter" <Brandon M. Hun...@discussions.microsoft.com> wrote in
message news:3787A7AE-C934-4CD5...@microsoft.com...
> Hi,
> I've been having the hardest time adding an image to a header in word
> using
> VBA Word. Below is the following code that I'm using to add an image to
> the
> header. In full I want to have the ability to add to the header and footer
> for each page.
>
>
> docActive.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
> docActive.Sections(1).Headers(1).InlineShapes.AddPicture sFileName, False,
> true
> With docActive.PageSetup
> .DifferentFirstPageHeaderFooter = False 'Set this to false will put
> text
> on first page, else will not.
> End With
>
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.InlineShapes.AddPicture
FileName:="Path\Filename"
As you probably want other things in the header, it is usually best to
insert a table in the header and then insert the picture into a particular
cell of that table
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,1).Range.InlineShapes.AddPicture Filename:="path\filename"--Hope this helps.Please reply to the newsgroup unless you wish to avail yourself of myservices on a paid consulting basis.Doug Robbins - Word MVP"Brandon M. Hunter" <Brandon...@discussions.microsoft.com> wrote inmessage news:523FFE3F-F65E-4931...@microsoft.com...> I've tried and it doesn't work when it comes to adding the image to the> header or footer. That would be nice, but all the code that I've tried,> fails. Do you have any sample code that I take a look at, or maybe help me> out with the code I posted. I've been at this for about 2 days. I can add> text to both the header and footer, but I can't add images.>> "Doug Robbins - Word MVP" wrote:>>> Why don't you start with a template that already contains the image? (and>> use code to delete it if there are some occasions when you do not wantit.)>>>> -->> 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>>>> "Brandon M. Hunter" <Brandon M. Hun...@discussions.microsoft.com> wrotein>> message news:3787A7AE-C934-4CD5...@microsoft.com...>> > Hi,>> > I've been having the hardest time adding an image to a header in word>> > using>> > VBA Word. Below is the following code that I'm using to add an image to>> > the>> > header. In full I want to have the ability to add to the header andfooter>> > for each page.>> >>> >>> > docActive.ActiveWindow.ActivePane.View.SeekView =wdSeekCurrentPageHeader>> > docActive.Sections(1).Headers(1).InlineShapes.AddPicture sFileName,False,>> > true>> > With docActive.PageSetup>> > .DifferentFirstPageHeaderFooter = False 'Set this to false will put>> > text>> > on first page, else will not.>> > End With>> >>>>>>>
It might work if you had:
docActive.Shapes(s).Select
Selection.Copy 'maybe Selection.CopyAsPicture
Set hdr1 = docActive.Sections(1).Headers(1)
hdr1.Range.Paste
You don't need to open the header pane if you are operating on the ..Range
of the header
Hence,
docActive.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
should not be necessary.
--
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
"Brandon M. Hunter" <Brandon...@discussions.microsoft.com> wrote in
message news:A42ACCA1-5A27-4C20...@microsoft.com...
Dim fdr1 As Range
then use
Set fdr1 = docActive.Sections(1).Footers(1).Range
fdr1.Paste
--
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
"Brandon M. Hunter" <Brandon...@discussions.microsoft.com> wrote in
message news:BB163EFA-5091-4C6E...@microsoft.com...
Dim fdr1 As Range
Selection.Copy
Set fdr1 = ActiveDocument.Sections(1).Footers(1).Range
fdr1.Paste
the picture is pasted into the footer.
And, if I run a macro with the following code
Dim fdr1 As Range
Selection.Copy
With ActiveDocument.Sections(1)
Set fdr1 = .Footers(1).Range
fdr1.Paste
Set fdr1 = .Headers(1).Range
fdr1.Paste
End With
End Sub
The picture is pasted into both the header and the footer.
As I have mentioned before, you do not need to open the header/footer pane
--
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
"Brandon M. Hunter" <Brandon...@discussions.microsoft.com> wrote in
message news:E13036CD-0297-4D66...@microsoft.com...