Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is there a Word merge code to show next month instead of the current month

Posted on 2006-11-27
14
Medium Priority
?
372 Views
Last Modified: 2012-05-05
I am currently using this field code to get the current month:

{DATE \@ "MMMM YYYY" \* MERGEFORMAT }

Which shows

November 2006


Is there a field code that I can enter to show next months date?

i.e.

December 2006


I basically need to alter the field to add one month to the current  date, so I guess if its possible it would be something like this:


{ADDMONTH(DATE,1) \@ "MMMM YYYY" \* MERGEFORMAT }
0
Comment
Question by:nmcdermaid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 2
  • +2
14 Comments
 
LVL 7

Expert Comment

by:gbahri
ID: 18025460
Hi nmcdermaid,

Try this field code:

{ QUOTE { IF { DATE \@ "M"}= 1 "12" "{={DATE \@ "M" }+1}"}/1/{DATE \@ "YYYY"} \@ "MMMM YYYY" \* MERGEFORMAT}

Hope, this is what you were looking for,

Thanks,

GBahri
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18025522
It probably is what I want, but MS Word won't accept it.

In the 'field' dialog box, the OK button is greyed out when I paste that string in.

It isn't greyed out when I just paste DATE in.

Therefore there may be an issue with opening/closing brackets and or quotes? I'm not too familiar with this type of syntax, it may be quicker if you could take another look.

... plus I'm in Australia here so maybe the date format when concatenating the string needs to d/m/y instead of m/d/y
0
 
LVL 22

Expert Comment

by:Dreamboat
ID: 18025527
To insert a set of the { } brackets, you must use Ctrl+F9. You cannot copy/paste them.

So, edit the existing merge field by changing it to say QUOTE, then hit space, then Ctrl+F9, then type IF, etc...
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Expert Comment

by:gbahri
ID: 18025630
For each pair of {} you'll have to use Ctrl+F9 as Dreamboat has said. Your field code should match with string so as to work correctly. For the Date part, I dont' think that will create any problem, give this a try.

Thanks,

GBahri
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18025867
Thanks guys. I gotta run now but I'll try it tommorow, it sounds like what I'm after!
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18033108
OK, I've created a field with just "DATE" in it, then I've hit "toggle field codes" and edited it.

Using CTRL-F9 (noting that it inserts BOLDED braces) I have entered the above formula. Then I hit 'toggle field codes' ....

its just showing todays date:


29/11/2006


The curious thing is if I flick back to the field code or copy and paste, it changes it to this:

{ QUOTE /1/ \@ "MMMM YYYY" \*}


.. which is a nice suprise after I laboriously typed it in!

Is there a way we can break this into bits to check which segment is causing issues?
0
 
LVL 7

Expert Comment

by:gbahri
ID: 18034198
Hi,

I think you are missing some field codes. You'll have to replicate each bit as it is. All the paired curly braces '{ }' denotes field code (you'll have to use Ctrl-F9. Altogether, there are Six field codes). I'm also attaching a zipped word file with above working field code. If you wish, you can copy field code from this document, its working fine.

https://filedb.experts-exchange.com/incoming/ee-stuff/1539-nmcdermaid.zip

cheers,

GBahri
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18035286
Thanks for that I'll give it a try tommorow.
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18050290
OK, its almost working except for the position of the month.

Basically its stuck on January because the MMMM format string is picking up the /1/ in the middle. The first number (which is the day in Australian format) is definitely moving along correctly.


Therefore it definitely needs to be in Australian format:

How do I move the /1/ to the front:

for example,

1/4/2007 for an input of March 2006  as opposed to 4/1/2007


I've tried messing with the codes but to no avail.


Thanks for your assistance so far, I'm learning a lot.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 18057949
Strewth Bruce,
Without getting too involved, in Pommieland our name for the fourth month is April. I guess there's more to Oz than just being excellent at team games.
;)
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18058263
LOL Crikey!

But when you add one to the month March becomes April (as per the original question), so I guess we both see these things slightly differently :)



0
 
LVL 4

Expert Comment

by:David Linker
ID: 18065359
From a fellow Aussie:

{ QUOTE "1/"{ IF { DATE \@ "M"}= 12 "1" "{={DATE \@ "M" }+1}"}"/"{ IF { DATE \@ "M" }= 12 {={ DATE \@ "yyyy" }+1 {DATE \@ "yyyy"} } \@ "MMMM yyyy" \* MERGEFORMAT}

Note - the original answer while helpful checked for January then made it December - when you need to check for December and make it January.  You also have to increment the year by one if it is December.  I fixed both these errors.

The field codes that keep "disappearing" after you type it in - you need to highlight just the text representing the "disappearing" code and press shift-F9 to make that piece visible as a code instead of it's value

I've also moved the month in to the middle to cope with our Aussie date format :-)
This will give you the answer you're after.  Note that the space is important - especially the space betweeen the = and 12 - which occurs in two places.




0
 
LVL 4

Accepted Solution

by:
David Linker earned 2000 total points
ID: 18065504
A Word .DOC containing this field is attached here:
https://filedb.experts-exchange.com/incoming/ee-stuff/1593-Next-Month.zip 
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18109864
Thats the ticket, thanks for that!
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question