Home > Blockchain >  MS Word field camp to distinguish between Good Morning, Good Afternoon,
MS Word field camp to distinguish between Good Morning, Good Afternoon,

Time:12-30

I need a field to automate a Word Document for the greeting based on time (good morning, good afternoon)

In excel, i know that

=IF(HOUR(NOW())<=11;"Good Morning, ";IF(HOUR(NOW())>=18;"Good Evening, ";"Good Afternoon, ")) 

The above formula in excel gives me a greeting based on day time How can i reflect that onto a Filed Code in MS Word? At least just Good Morning and Good Afternoon

I tried this way there in a field code

 { IF {TIME  \@ "am/pm"} = "am" "Good Morning,", "Good Afternoon" }

But doesn't seem to work

If anyone can tell me what is wrong in this code, or missing I'll be grateful.

Thank you

CodePudding user response:

For example:

Good {=INT({TIME \@ hh}/6)-2 \# "'evening';'morning';'afternoon'"}

Note: Both sets of field brace pairs (i.e. '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. The spaces represented in the field construction are all required.

  • Related