Senad Isanovic was telling us:
Senad Isanovic nous racontait que :
> Need a button (vba code) that inserts a logotype in a header (there
> is a bookmark b in a table). When the logotype is inserted and the
[quoted text clipped - 4 lines]
> first page only (regardless from where you are in the document).
> Thanks for any help
I have a very nice wooden button I could DHL to you...
Seriously, what kind of button are you talking about? ActiveX, Toolbar,
userform, Macrobutton?
What code have you got so far?
Is the logo only visible on the first page?
What Word version?

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Senad Isanovic - 08 Dec 2004 15:43 GMT
I'm talking about button in Word toolbar that will run a macro. The code I
have so far..
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:= _
"C:\bilder\al425.jpg", LinkToFile:=False, SaveWithDocument:=True
I'm using Word XP.
> Senad Isanovic was telling us:
> Senad Isanovic nous racontait que :
[quoted text clipped - 16 lines]
> Is the logo only visible on the first page?
> What Word version?
Jean-Guy Marcil - 08 Dec 2004 17:09 GMT
Senad Isanovic was telling us:
Senad Isanovic nous racontait que :
> I'm talking about button in Word toolbar that will run a macro. The
> code I have so far..
Insert a bookmark (Named "logotype" in my example) in the primary header
where you want the logo to appear. Ideally it should be an empty paragraph,
otherwise we might have to modify the code.
'_______________________________________
Sub AddLogo()
Dim HeaderRange As Range
Const BookName As String = "logotype"
Set HeaderRange = ActiveDocument.Sections(1) _
.Headers(wdHeaderFooterPrimary).Range _
.Bookmarks(BookName).Range
With HeaderRange
If .InlineShapes.Count = 0 Then
.Collapse
.InlineShapes.AddPicture _
FileName:="C:\bilder\al425.jpg", _
LinkToFile:=False, SaveWithDocument:=True
Set HeaderRange = HeaderRange.Paragraphs(1).Range
ActiveDocument.Bookmarks.Add BookName, HeaderRange
End If
End With
End Sub
'_______________________________________
'_______________________________________
Sub RemoveLogo()
Dim HeaderRange As Range
Const BookName As String = "logotype"
Set HeaderRange = ActiveDocument.Sections(1) _
.Headers(wdHeaderFooterPrimary).Range _
.Bookmarks(BookName).Range
With HeaderRange
If .InlineShapes.Count > 0 Then
.InlineShapes(1).Delete
Set HeaderRange = HeaderRange.Paragraphs(1).Range
ActiveDocument.Bookmarks.Add BookName, HeaderRange
End If
End With
End Sub
'_______________________________________

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org