Tags:
vb visual basic Visual Basic for Applications
I need to create a macro in word 2003 that will insert a background image onto all sections of a document where the pages are defined to print on the wdPrinterLowerBin. I am struggling with the code so far I have: -
Sub background()
Dim x As Integer, background As Shape
x = 1
Do While x <= Selection.Information(wdNumberOfPagesInDocument)
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=x
If Selection.PageSetup.FirstPageTray = wdPrinterLowerBin Then
Set background = ActiveDocument.Shapes.AddPicture("\\mbs-server\public\MBS Background\MBSLhead.jpg")
background.ScaleHeight 1, True
background.ScaleWidth 1, True
background.PictureFormat.Brightness = 0.5
background.PictureFormat.Contrast = 0.5
background.Height = CentimetersToPoints(29.7)
background.Width = CentimetersToPoints(21)
background.LockAspectRatio = True
background.WrapFormat.AllowOverlap = True
background.WrapFormat.Side = wdWrapNone
background.WrapFormat.Type = 2
background.RelativeHorizontalPosition = _
wdRelativeVerticalPositionMargin
background.RelativeVerticalPosition = _
wdRelativeVerticalPositionMargin
background.Left = wdShapeCenter
background.Top = wdShapeCenter
End If
x = x + 1
Loop
End Sub
| Top Expert: |
GrahamSkan |
| Expert Since: |
12/05/2002 |
| Accepted Solutions: |
4733 |
| Computer Expertise: |
Advanced |
GrahamSkan has been an Expert for 6 years1 month, during which he has posted 17362 comments
and answered 4733 questions. GrahamSkan is just one of 2179 experts in the Visual Basic Programming Zone.
20081119-EE-VQP-47 / EE_QW_2_20070628