mdnuts
Registered User.
- Local time
- Yesterday, 22:17
- Joined
- May 28, 2014
- Messages
- 131
Hello,
Having trouble getting access vba to set a word document's header properly. I've got this.
What happens right now is the text will replace the picture for the first page (subsequent pages are fine).
I need to have the picture and text - and I need to offset the picture to the left about half an inch while text is centered with normal margins.
**Update**
I got half of it done, now I just need to alter the position of the image.
Having trouble getting access vba to set a word document's header properly. I've got this.
Code:
oDoc.PageSetup.DifferentFirstPageHeaderFooter = True
oDoc.Sections(1).Headers(wdHeaderFooterFirstPage).Range.InlineShapes.AddPicture "C:\Users\mr.helpless\Pictures\doody.jpg"
oDoc.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Text = "hello there"
oDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "whooo hooo!"
I need to have the picture and text - and I need to offset the picture to the left about half an inch while text is centered with normal margins.
**Update**
I got half of it done, now I just need to alter the position of the image.
Code:
Dim myText As String
myText = "hello there"
With oDoc.Sections(1).Headers(wdHeaderFooterFirstPage)
.Shapes.AddPicture Filename:="C:\Users\mr.helpless\Pictures\doody.jpg", LinkToFile:=False, SaveWithDocument:=True
.Range.Collapse
.Range.InsertAfter (myText)
.Range.Font.Name = "Helvetica"
.Range.Font.Size = 8
.Range.Font.Bold = True
.Range.Paragraphs.Alignment = wdAlignParagraphCenter
End With
Last edited: