Hi,
I don't know if I'm using classes. Word2000 Dutch. Here's the code, gotten
from a macro, which implements the picture and puts it on the exact place:
Sub Huisstijl_logo()
If Documents.Count >= 1 Then
Selection.HomeKey Unit:=wdStory
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.InlineShapes.AddPicture FileName:= _
"G:\Templates\wstmmm1.gif", LinkToFile:=False, _
SaveWithDocument:=True
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.InlineShapes(1).ConvertToShape.Select
Selection.ShapeRange.Name = "logo"
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoFalse
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 83.35
Selection.ShapeRange.Width = 197.85
Selection.ShapeRange.PictureFormat.Brightness = 0.5
Selection.ShapeRange.PictureFormat.Contrast = 0.5
Selection.ShapeRange.PictureFormat.ColorType = msoPictureAutomatic
Selection.ShapeRange.PictureFormat.CropLeft = 0#
Selection.ShapeRange.PictureFormat.CropRight = 0#
Selection.ShapeRange.PictureFormat.CropTop = 0#
Selection.ShapeRange.PictureFormat.CropBottom = 0#
Selection.ShapeRange.RelativeHorizontalPosition =
wdRelativeHorizontalPositionPage
Selection.ShapeRange.RelativeVerticalPosition =
wdRelativeVerticalPositionPage
Selection.ShapeRange.Left = CentimetersToPoints(1.5)
Selection.ShapeRange.Top = CentimetersToPoints(1)
Selection.ShapeRange.LockAnchor = False
Selection.ShapeRange.WrapFormat.AllowOverlap = True
Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
Selection.ShapeRange.WrapFormat.DistanceTop = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0)
Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
Selection.ShapeRange.WrapFormat.Type = wdWrapTight
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.WindowState = wdWindowStateNormal
ActiveWindow.WindowState = wdWindowStateNormal
Else
MsgBox "Er is geen actief document!"
End If
End Sub
> G'day "Cor van der Bliek" <CorvanderBliek@discussions.microsoft.com>,
>
[quoted text clipped - 19 lines]
> >the picture with a certain name) in all headers of the active document.
> >Who can help?
Word Heretic - 19 Feb 2005 00:16 GMT
G'day "Cor van der Bliek" <CorvanderBliek@discussions.microsoft.com>,
Which line causes the problem or does the whole thing refuse to run?
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
Cor van der Bliek reckoned:
>Hi,
>I don't know if I'm using classes. Word2000 Dutch. Here's the code, gotten
[quoted text clipped - 79 lines]
>> >the picture with a certain name) in all headers of the active document.
>> >Who can help?
Cor van der Bliek - 21 Feb 2005 07:57 GMT
There's no line number mentioned.
> G'day "Cor van der Bliek" <CorvanderBliek@discussions.microsoft.com>,
>
[quoted text clipped - 90 lines]
> >> >the picture with a certain name) in all headers of the active document.
> >> >Who can help?
Word Heretic - 22 Feb 2005 02:37 GMT
G'day "Cor van der Bliek" <CorvanderBliek@discussions.microsoft.com>,
is there a highlighted line when it fails?
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
Cor van der Bliek reckoned:
>There's no line number mentioned.
>
[quoted text clipped - 92 lines]
>> >> >the picture with a certain name) in all headers of the active document.
>> >> >Who can help?
Cor van der Bliek - 24 Feb 2005 21:24 GMT
Joost Verdaasdonk supplied the solution in the Dutch forum www.helpmij.nl:
Const sPic As String = "C:\Documents and Settings\Admin\My Documents\My
Pictures\logo\hills.jpg"
'Const sPic As String = "G:\Templates\wstmmm1.gif" 'this one is yours!
Sub Logo()
Dim oSec As Word.Section
Dim oHead As Word.HeaderFooter
Dim oShape As Word.Shape
Dim iCnt As Integer
Dim sName As String
If Documents.Count = 0 Then Exit Sub
Application.ScreenUpdating = False
For Each oSec In ActiveDocument.Sections
If oSec.Index > 0 And oSec.Index <= ActiveDocument.Sections.Count Then
For Each oHead In oSec.Headers
Set oShape = oHead.Shapes.AddPicture(sPic)
With oShape
.Name = CStr("Pic" & iCnt)
.LockAspectRatio = msoTrue
.Height = 83.35
.Width = 197.85
.RelativeHorizontalPosition =
wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.Left = CentimetersToPoints(1.5)
.Top = CentimetersToPoints(1)
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapBoth
.WrapFormat.DistanceTop = CentimetersToPoints(0)
.WrapFormat.DistanceBottom = CentimetersToPoints(0)
.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
.WrapFormat.Type = wdWrapTight
End With
iCnt = iCnt + 1
Next
End If
Next
Set oShape = Nothing
End Sub
-------------
The following Sub deletes the picture in any header in the document:
-------------
Sub DeleteLogo()
Dim oSec1 As Word.Section
Dim oHead1 As Word.HeaderFooter
Dim oShape1 As Word.Shape
If Documents.Count = 0 Then Exit Sub
Application.ScreenUpdating = False
For Each oSec1 In ActiveDocument.Sections
If oSec1.Index > 0 And oSec1.Index <= ActiveDocument.Sections.Count Then
For Each oHead1 In oSec1.Headers
For Each oShape1 In oHead1.Shapes
If Left(oShape1.Name, 3) = "Pic" Then
oShape1.Delete
End If
Next
Next
End If
Next
End Sub
--------------------------------------------------------------------------------
> G'day "Cor van der Bliek" <CorvanderBliek@discussions.microsoft.com>,
>
[quoted text clipped - 103 lines]
> >> >> >the picture with a certain name) in all headers of the active document.
> >> >> >Who can help?