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 user clicks on
the button again it should not be inserted again. I also need the button
that will remove the picture (logotype) if the user wants to undo the insert
button. The documents can contain several pages, but the buttons should
insert / remove the logo on the first page only (regardless from where you
are in the document). Thanks for any help

Re: Insert logo by Jean-Guy

Jean-Guy
Tue Dec 07 12:58:45 CST 2004

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
> user clicks on the button again it should not be inserted again. I
> also need the button that will remove the picture (logotype) if the
> user wants to undo the insert button. The documents can contain
> several pages, but the buttons should insert / remove the logo on the
> 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?
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: Insert logo by Senad

Senad
Wed Dec 08 09:43:28 CST 2004

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.


"Jean-Guy Marcil" <no-spam@leaveme.alone> skrev i meddelandet
news:%23xykG7I3EHA.2012@TK2MSFTNGP15.phx.gbl...
> 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
>> user clicks on the button again it should not be inserted again. I
>> also need the button that will remove the picture (logotype) if the
>> user wants to undo the insert button. The documents can contain
>> several pages, but the buttons should insert / remove the logo on the
>> 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?
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>



Re: Insert logo by Jean-Guy

Jean-Guy
Wed Dec 08 11:09:34 CST 2004

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
'_______________________________________

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