Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Table in a Form | Tables | |||
Possible bug when recording a Word Macro | Microsoft Word Help | |||
Insert ELECTRONIC Signature (NOT DIGITAL) in Word Document? | Microsoft Word Help | |||
Save As is not working due to macro security settings | Microsoft Word Help | |||
2000 to 2002 macro and "Could not open macro storage" | Mailmerge |