#1   Report Post  
Brian
 
Posts: n/a
Default Signature macro

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: "
Selection.TypeParagraph
Selection.Font.Size = 12
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterUpperBin
End With
End Sub



  #2   Report Post  
TF
 
Posts: n/a
Default

You need to format the address with the Hyperlink Style rather than use
direct formatting.

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

"Brian" wrote in message
...
: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: "
: Selection.TypeParagraph
: Selection.Font.Size = 12
: With ActiveDocument.PageSetup
: .FirstPageTray = wdPrinterLowerBin
: .OtherPagesTray = wdPrinterUpperBin
: End With
: End Sub
:
:
:


  #3   Report Post  
Greg
 
Posts: n/a
Default

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, "
.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.

  #4   Report Post  
Doug Robbins
 
Posts: n/a
Default

Use:

Dim myrange As Range
Set myrange = Selection.Range
myrange.Hyperlinks.Add Anchor:=myrange,

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" wrote in message
...
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: "
Selection.TypeParagraph
Selection.Font.Size = 12
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterUpperBin
End With
End Sub





  #5   Report Post  
Brian
 
Posts: n/a
Default

Many thanks for all the replies.

"Doug Robbins" wrote in message
...
Use:

Dim myrange As Range
Set myrange = Selection.Range
myrange.Hyperlinks.Add Anchor:=myrange,

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" wrote in message
...
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: "
Selection.TypeParagraph
Selection.Font.Size = 12
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterUpperBin
End With
End Sub







Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table in a Form HiDbLevel Tables 12 February 27th 06 12:59 PM
Possible bug when recording a Word Macro Raven95 Microsoft Word Help 4 April 30th 05 09:49 PM
Insert ELECTRONIC Signature (NOT DIGITAL) in Word Document? INDYRECP Microsoft Word Help 1 April 14th 05 02:53 AM
Save As is not working due to macro security settings Craig Meritz Microsoft Word Help 1 December 16th 04 03:53 AM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 10:37 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"