Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2024, 03:10 PM
Ren1975 Ren1975 is offline Hyperlink inside if then else statement in word Windows 10 Hyperlink inside if then else statement in word Office 2010
Novice
Hyperlink inside if then else statement in word
 
Join Date: Mar 2024
Posts: 9
Ren1975 is on a distinguished road
Default Hyperlink inside if then else statement in word

Good morning,



I am hoping someone can assist with an issue I am having in Word with hyperlinks. I am trying to achieve the following -

{IF {Mergefield ExitSurvey_YN} = Y "We are always concerned when a member cancels or transfers their membership. For this reason, we would appreciate your feedback on our Member Exit Survey. It should take you less than 5 minutes to complete. Please click here to start the survey" ""}

The word 'here' in the last sentence needs to be a hyperlink to our survey, I have managed to get the hyperlink to work and display as the web address, but every time I try to have the text to display as 'here' it ends up in plain text with no link when emailed.

Thanks
Renee
Reply With Quote
  #2  
Old 08-20-2024, 05:53 PM
macropod's Avatar
macropod macropod is offline Hyperlink inside if then else statement in word Windows 10 Hyperlink inside if then else statement in word Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Not possible. The hyperlink would have to be added post-merge (e.g. via VBA).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 08-20-2024, 08:23 PM
Ren1975 Ren1975 is offline Hyperlink inside if then else statement in word Windows 10 Hyperlink inside if then else statement in word Office 2010
Novice
Hyperlink inside if then else statement in word
 
Join Date: Mar 2024
Posts: 9
Ren1975 is on a distinguished road
Default Hyperlink inside if then else statement in word

Thanks so much, I thought I was going crazy
Reply With Quote
  #4  
Old 02-27-2025, 07:11 PM
macropod's Avatar
macropod macropod is offline Hyperlink inside if then else statement in word Windows 10 Hyperlink inside if then else statement in word Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Update:

If you add the following macro to your mailmerge main document, clicking on the 'Edit Individual Documents' button will intercept the merge and convert any email and hyperlink strings in the output document to working hyperlinks.

Code:
Sub MailMergeToDoc()
Application.ScreenUpdating = False
Dim bHead As Boolean, bList As Boolean, bBullet As Boolean, _
  bOther As Boolean, bQuote As Boolean, bSymbol As Boolean, _
  bOrdinal As Boolean, bFraction As Boolean, bEmphasis As Boolean, _
  bHLink As Boolean, bStyle As Boolean, bMail As Boolean, bTag As Boolean
'Store the current autoformat options
With Options
  bHead = .AutoFormatApplyHeadings
  bList = .AutoFormatApplyLists
  bBullet = .AutoFormatApplyBulletedLists
  bOther = .AutoFormatApplyOtherParas
  bQuote = .AutoFormatReplaceQuotes
  bSymbol = .AutoFormatReplaceSymbols
  bOrdinal = .AutoFormatReplaceOrdinals
  bFraction = .AutoFormatReplaceFractions
  bEmphasis = .AutoFormatReplacePlainTextEmphasis
  bHLink = .AutoFormatReplaceHyperlinks
  bStyle = .AutoFormatPreserveStyles
  bMail = .AutoFormatPlainTextWordMail
  bTag = .LabelSmartTags
End With
'Restrict autoformating to emails and hyperlinks
With Options
  .AutoFormatApplyHeadings = False
  .AutoFormatApplyLists = False
  .AutoFormatApplyBulletedLists = False
  .AutoFormatApplyOtherParas = False
  .AutoFormatReplaceQuotes = False
  .AutoFormatReplaceSymbols = False
  .AutoFormatReplaceOrdinals = False
  .AutoFormatReplaceFractions = False
  .AutoFormatReplacePlainTextEmphasis = False
  .AutoFormatReplaceHyperlinks = True
  .AutoFormatPreserveStyles = False
  .AutoFormatPlainTextWordMail = True
  .LabelSmartTags = False
End With
'Execute the Mailmerge
ActiveDocument.MailMerge.Execute
'Apply the autoformating to the output document
ActiveDocument.Range.AutoFormat
'Restore the original autoformat options
With Options
  .AutoFormatApplyHeadings = bHead
  .AutoFormatApplyLists = bList
  .AutoFormatApplyBulletedLists = bBullet
  .AutoFormatApplyOtherParas = bOther
  .AutoFormatReplaceQuotes = bQuote
  .AutoFormatReplaceSymbols = bSymbol
  .AutoFormatReplaceOrdinals = bOrdinal
  .AutoFormatReplaceFractions = bFraction
  .AutoFormatReplacePlainTextEmphasis = bEmphasis
  .AutoFormatReplaceHyperlinks = bHLink
  .AutoFormatPreserveStyles = bStyle
  .AutoFormatPlainTextWordMail = bMail
  .LabelSmartTags = bTag
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Export Embedded Docs inside Word dhen21dx Word 2 03-25-2019 01:58 AM
Converting a Select statement in Excel to an update statement shabbaranks Excel Programming 5 10-31-2018 11:47 PM
Text inside text boxes create headings inside my table of contents!!! How do I delete the created he carstj Word 3 04-11-2016 12:46 PM
How to create a MS word file that automatically logs something specific inside other WORD files? meys Word VBA 1 01-04-2015 05:22 AM
Invoking a command line from inside Word bolpom Word 1 03-16-2011 03:03 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:21 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