Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-08-2017, 06:32 PM
jeffreybrown jeffreybrown is offline Hide a certain date from the mergefield Windows Vista Hide a certain date from the mergefield Office 2007
Expert
Hide a certain date from the mergefield
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default Hide a certain date from the mergefield

I have a mergefield...



{ MERGEFIELD Anniv \@ "MMM d";}

...to show an anniversary date, but if the date equals 1/1/2016, I would like nothing to show in that field.

If there is a date other than 1/1/2016, how can I add text to the date?

Such as...

Anniversary: Nov 15
Reply With Quote
  #2  
Old 09-09-2017, 03:02 AM
gmayor's Avatar
gmayor gmayor is offline Hide a certain date from the mergefield Windows 10 Hide a certain date from the mergefield Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

{ IF { MERGEFIELD Anniv \@ "MM/dd/yyyy" } <> "1/1/2016" "Anniversary: {MERGEFIELD Anniv \@ "MMM d" }" }
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 09-09-2017, 05:44 AM
jeffreybrown jeffreybrown is offline Hide a certain date from the mergefield Windows Vista Hide a certain date from the mergefield Office 2007
Expert
Hide a certain date from the mergefield
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Hi Graham,

Thanks for the help, but the records with 1/1/2016 still show up.

I see where my initials error was, I wasn't comparing the date correctly, but is word comparing the date how it is formatted in the Excel document?

Also, with trying to understand the string you posted, where is the false side?

I found some code on-line which would allow you to post your current string as you did above without having to type it out, but it seemed old and did not work.

Do you know where such a code exists?
Reply With Quote
  #4  
Old 09-09-2017, 08:07 AM
jeffreybrown jeffreybrown is offline Hide a certain date from the mergefield Windows Vista Hide a certain date from the mergefield Office 2007
Expert
Hide a certain date from the mergefield
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Hi Graham,

Got it figured out...

I'd still be interested if you know or have some code which can help me post a mergefield string without the retyping or posting a picture.
Attached Images
File Type: gif Capture.GIF (7.5 KB, 15 views)
Reply With Quote
  #5  
Old 09-09-2017, 11:30 PM
macropod's Avatar
macropod macropod is offline Hide a certain date from the mergefield Windows 7 64bit Hide a certain date from the mergefield Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

For macros to:
convert field codes to text strings on the clipboard, see: http://www.gmayor.com/export_field.htm#FieldToText
convert field text strings to field codes in a document, see: http://www.gmayor.com/export_field.htm#TextToField
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 09-10-2017, 01:09 AM
gmayor's Avatar
gmayor gmayor is offline Hide a certain date from the mergefield Windows 10 Hide a certain date from the mergefield Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Paul has covered the links to code to post field constructions.

As for the construction I posted (without access to your data to see what the field actually produced) it doesn't need the alternative. If the condition is not met, the field produces nothing. The idea being to compare what { MERGEFIELD Anniv } produces with the equivalent date in the same format.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #7  
Old 09-10-2017, 06:34 AM
jeffreybrown jeffreybrown is offline Hide a certain date from the mergefield Windows Vista Hide a certain date from the mergefield Office 2007
Expert
Hide a certain date from the mergefield
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Thanks Paul and Graham.

@Graham, I finally got the formats the same and it works as you posted. Thanks again.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Hide/Un-hide a worksheet based on cell on another sheet. easton11 Excel Programming 1 06-02-2015 12:07 PM
Hide a certain date from the mergefield Printing selected pages based on a MERGEFIELD.g. If MERGEFIELD=x then print pages 1,2,4 if MERGEFIEL Richard.p Word 3 04-21-2015 01:14 AM
SUM a single mergefield kawirider88 Mail Merge 1 09-29-2013 06:37 PM
Hide a certain date from the mergefield Substituting a value using MERGEFIELD CharlieVW Mail Merge 3 05-07-2012 12:11 PM
Mergefield date error michielvanderbiest Mail Merge 1 04-12-2010 11:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:26 AM.


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