Signature macro



Brian
07-10-2005, 12:02 AM
I have worked out a signature macro, but there is one small annoyance with
it. It does not underline the email address. If you enter an email address
directly into a document, Word can recognise it as an email address. But
running this macro does not underline it.

Any suggestions, or is this just a genuine "feature"?


Selection.Font.Bold = wdToggle
Selection.TypeText Text:="Firstname Lastname"
Selection.TypeParagraph
Selection.Font.Bold = wdToggle
Selection.Font.Size = 8
Selection.TypeText Text:="Email: ab@abc.com "
Selection.TypeParagraph
Selection.Font.Size = 12
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterUpperBin
End With
End Sub

TF
07-10-2005, 12:02 AM
You need to format the address with the Hyperlink Style rather than use
direct formatting.

--
Terry Farrell - Word MVP
http://word.mvps.org/

"Brian" <bxxcfilm@nildram.co.uk> wrote in message
news:ugKskL7XFHA.796@TK2MSFTNGP09.phx.gbl...
:I have worked out a signature macro, but there is one small annoyance with
: it. It does not underline the email address. If you enter an email address
: directly into a document, Word can recognise it as an email address. But
: running this macro does not underline it.
:
: Any suggestions, or is this just a genuine "feature"?
:
:
: Selection.Font.Bold = wdToggle
: Selection.TypeText Text:="Firstname Lastname"
: Selection.TypeParagraph
: Selection.Font.Bold = wdToggle
: Selection.Font.Size = 8
: Selection.TypeText Text:="Email: ab@abc.com "
: Selection.TypeParagraph
: Selection.Font.Size = 12
: With ActiveDocument.PageSetup
: .FirstPageTray = wdPrinterLowerBin
: .OtherPagesTray = wdPrinterUpperBin
: End With
: End Sub
:
:
:

Greg
07-10-2005, 12:02 AM
Brian,

You are observing one of the drawbacks of recording macros. Sometimes
what you get is not what you expect. You can create your signature
text with the hyperlink using ranges something like this:


Sub Signature()
Dim myRange As Range
Set myRange = Selection.Range

With myRange
.Text = "FirstName LastName" & vbCr
.Font.Bold = True
.Collapse wdCollapseEnd
.Text = "Email: "
.Font.Bold = False
.Font.Size = 8
.Collapse wdCollapseEnd
.Hyperlinks.Add myRange, "youraddress@yourservice.org"
.Expand wdSentence
.Font.Size = 8
.Collapse wdCollapseEnd
.Text = vbCr
.Collapse wdCollapseEnd
.MoveEnd wdParagraph, 1
.Font.Size = 12
.MoveEnd wdCharacter, -1
.Select
End With
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterUpperBin
End With

End Sub

However, a more useful methdo might be to simply format your signature
text like you want it, select it, press Alt+F3 and create a AutoText
entery. Call it signedbrian and when you want to sign off just type
sign.. and when the autocomplete tip fires press enter.

Doug Robbins
07-10-2005, 12:02 AM
Use:

Dim myrange As Range
Set myrange = Selection.Range
myrange.Hyperlinks.Add Anchor:=myrange, Address:=ab@abc.com

In the code, the email address needs to be enclosed in quotes - the email
program automatically strips them off and converts the address.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
"Brian" <bxxcfilm@nildram.co.uk> wrote in message
news:ugKskL7XFHA.796@TK2MSFTNGP09.phx.gbl...
>I have worked out a signature macro, but there is one small annoyance with
> it. It does not underline the email address. If you enter an email address
> directly into a document, Word can recognise it as an email address. But
> running this macro does not underline it.
>
> Any suggestions, or is this just a genuine "feature"?
>
>
> Selection.Font.Bold = wdToggle
> Selection.TypeText Text:="Firstname Lastname"
> Selection.TypeParagraph
> Selection.Font.Bold = wdToggle
> Selection.Font.Size = 8
> Selection.TypeText Text:="Email: ab@abc.com "
> Selection.TypeParagraph
> Selection.Font.Size = 12
> With ActiveDocument.PageSetup
> .FirstPageTray = wdPrinterLowerBin
> .OtherPagesTray = wdPrinterUpperBin
> End With
> End Sub
>
>
>

Brian
07-10-2005, 12:02 AM
Many thanks for all the replies.

"Doug Robbins" <dkr@REMOVEmvps.org> wrote in message
news:OBiF9s8XFHA.228@TK2MSFTNGP12.phx.gbl...
> Use:
>
> Dim myrange As Range
> Set myrange = Selection.Range
> myrange.Hyperlinks.Add Anchor:=myrange, Address:=ab@abc.com
>
> In the code, the email address needs to be enclosed in quotes - the email
> program automatically strips them off and converts the address.
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
> "Brian" <bxxcfilm@nildram.co.uk> wrote in message
> news:ugKskL7XFHA.796@TK2MSFTNGP09.phx.gbl...
> >I have worked out a signature macro, but there is one small annoyance
with
> > it. It does not underline the email address. If you enter an email
address
> > directly into a document, Word can recognise it as an email address. But
> > running this macro does not underline it.
> >
> > Any suggestions, or is this just a genuine "feature"?
> >
> >
> > Selection.Font.Bold = wdToggle
> > Selection.TypeText Text:="Firstname Lastname"
> > Selection.TypeParagraph
> > Selection.Font.Bold = wdToggle
> > Selection.Font.Size = 8
> > Selection.TypeText Text:="Email: ab@abc.com "
> > Selection.TypeParagraph
> > Selection.Font.Size = 12
> > With ActiveDocument.PageSetup
> > .FirstPageTray = wdPrinterLowerBin
> > .OtherPagesTray = wdPrinterUpperBin
> > End With
> > End Sub
> >
> >
> >
>
>


Signature macro