Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-19-2017, 02:57 PM
jeffreybrown jeffreybrown is offline Creating Hyperlinks after a Mail Merge Windows Vista Creating Hyperlinks after a Mail Merge Office 2007
Expert
Creating Hyperlinks after a Mail Merge
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default Creating Hyperlinks after a Mail Merge


After running the mail merge, I use the code below to turn e-mail addressed into hyperlinks, but the text gets indented.

Code:
Sub MakeLinks()
    Application.ScreenUpdating = False
    Dim Rng As Range
    With ActiveDocument
        Set Rng = .Range
        With .Range
            With .Find
                .ClearFormatting
                .Replacement.ClearFormatting
                .text = "<[0-9A-ÿ.\-]{1,}\@[0-9A-ÿ\-.]{1,}"
                .Replacement.text = ""
                .Forward = True
                .Wrap = wdFindStop
                .Format = False
                .MatchWildcards = True
                .Execute
            End With
            Do While .Find.Found
                .Duplicate.AutoFormat
                .Collapse wdCollapseEnd
                .Find.Execute
            Loop
            .End = Rng.Start
            With .Find
                .text = "http://[! ]{1,}"
                .Execute
            End With
            Do While .Find.Found
                .Duplicate.AutoFormat
                .Collapse wdCollapseEnd
                .Find.Execute
            Loop
        End With
    End With
    Application.ScreenUpdating = True
End Sub
Without creating a table for each mail merge field, can this be overcome? In the mail merge template, the e-mail is preceded by a phone number, which is this case is blank. I have tab stops setup in the mail merge template to space out the phone number followed by the e-mail.
Attached Images
File Type: gif Capture.GIF (3.2 KB, 21 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Hyperlinks after a Mail Merge Hyperlinks in IF...THEN Mail Merge ljg713 Mail Merge 18 12-16-2015 11:35 PM
Creating Hyperlinks after a Mail Merge Creating recipient list for mail-merge Roger Keeling Mail Merge 2 05-23-2015 04:34 AM
Creating new documents from a mail merge template pnjcarter Mail Merge 1 02-03-2014 06:42 PM
Mail merge from Excel to Word and include hyperlinks chay Mail Merge 5 09-28-2013 01:16 AM
Need help creating a data base for mail merge. acedking90 Mail Merge 0 07-27-2009 11:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft