SOLVED

Automate adding date to report

%3CLINGO-SUB%20id%3D%22lingo-sub-1488610%22%20slang%3D%22en-US%22%3EAutomate%20adding%20date%20to%20report%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1488610%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20simple%20report%20which%20is%20created%20using%20MS%20Word%2C%20each%20time%20I%20use%20the%20report%20I%20need%20to%20change%20the%20Month%20and%20year%2C%20to%20reflect%20the%20current%20content%20I%20am%20reporting%20on.%26nbsp%3B%20Is%20there%20a%20way%20to%20create%20field%20for%20the%20Month%20and%20year%20values%2C%20then%20when%20I%20open%20the%20document%20a%20popup%20or%20user%20input%20window%20appears%20to%20allow%20the%20user%20to%20add%20these%20details%3B%20Month%20and%20a%20year%20value.%26nbsp%3B%20All%20fields%20throughout%20the%20document%20are%20updated%20accordingly.%26nbsp%3B%20Or%20alternately%2C%20is%20there%20a%20means%20to%20ask%20MS%20Word%20to%20prompt%20for%20these%20details%20when%20the%20document%20is%20opened%20and%20again%20update%20the%20value%20throughout%20the%20document%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%20Chris%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493144%22%20slang%3D%22en-US%22%3ERe%3A%20Automate%20adding%20date%20to%20report%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493144%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F544914%22%20target%3D%22_blank%22%3E%40ChrisC365%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBefore%20answering%20directly%2C%20I'll%20say%20that%20if%20you're%20in%20the%20habit%20of%20opening%20a%20previous%20month's%20report%20and%20modifying%20it%20with%20new%20data%2C%20that's%20a%20poor%20practice.%20For%20one%20thing%2C%20it%20risks%20accidentally%20overwriting%20the%20previous%20report%20with%20the%20new%20one%3B%20if%20you%20don't%20have%20reliable%20backups%2C%20the%20previous%20version%20of%20the%20document%20is%20not%20recoverable.%20The%20proper%20way%20to%20use%20Word%20is%20to%20make%20a%20template%20of%20the%20report%20--%20you%20can%20do%20that%20simply%20by%20using%20File%20%26gt%3B%20Save%20As%20and%20changing%20the%20file%20type%20from%20.docx%20to%20.dotx.%20Then%20use%20the%20File%20%26gt%3B%20New%20command%20(or%20just%20double-click%20the%20template's%20icon%20in%20File%20Explorer)%20to%20base%20each%20new%20document%20on%20the%20template.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20make%20your%20Month%20and%20Year%20fields%2C%20use%20the%20Insert%20%26gt%3B%20Quick%20Parts%20%26gt%3B%20Field%20dialog%20to%20insert%20these%20two%20fields%20at%20the%20beginning%20of%20the%20template%20(or%20just%20press%20Ctrl%2BF9%20to%20insert%20the%20field%20brackets%2C%20and%20type%20the%20text%20between%20them)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%20FILLIN%20%22Enter%20month%22%20%7D%20%7B%20FILLIN%20%22Enter%20year%22%20%7D%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESelect%20the%20two%20fields%20and%20insert%20a%20bookmark%20named%20Month_Year.%20Then%20press%20Alt%2BF9%20once%20(or%20maybe%20twice)%20so%20the%20field%20codes%20disappear.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20each%20place%20in%20the%20template%20where%20you%20want%20the%20month%20and%20year%20to%20appear%2C%20insert%20this%20field%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%20REF%20Month_Year%20%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESave%20the%20template%20and%20close%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20you%20create%20a%20new%20document%20based%20on%20the%20template%2C%20these%20two%20boxes%20will%20appear%20first%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%221.png%22%20style%3D%22width%3A%20327px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F201584i7AC84214DBB6F59B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%221.png%22%20alt%3D%221.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EWhen%20the%20document%20appears%20on%20the%20screen%2C%20the%20month%20and%20year%20will%20appear%20in%20the%20FILLIN%20fields%20and%20all%20the%20REF%20fields.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20make%20a%20mistake%20and%20want%20to%20change%20the%20date%2C%20select%20the%20whole%20document%20(Ctrl%2BA)%20and%20update%20its%20fields%20(F9).%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi

 

I have a simple report which is created using MS Word, each time I use the report I need to change the Month and year, to reflect the current content I am reporting on.  Is there a way to create field for the Month and year values, then when I open the document a popup or user input window appears to allow the user to add these details; Month and a year value.  All fields throughout the document are updated accordingly.  Or alternately, is there a means to ask MS Word to prompt for these details when the document is opened and again update the value throughout the document?

 

Many thanks Chris

1 Reply
Best Response confirmed by ChrisC365 (Occasional Contributor)
Solution

@ChrisC365 

Before answering directly, I'll say that if you're in the habit of opening a previous month's report and modifying it with new data, that's a poor practice. For one thing, it risks accidentally overwriting the previous report with the new one; if you don't have reliable backups, the previous version of the document is not recoverable. The proper way to use Word is to make a template of the report -- you can do that simply by using File > Save As and changing the file type from .docx to .dotx. Then use the File > New command (or just double-click the template's icon in File Explorer) to base each new document on the template.

 

To make your Month and Year fields, use the Insert > Quick Parts > Field dialog to insert these two fields at the beginning of the template (or just press Ctrl+F9 to insert the field brackets, and type the text between them):

 

{ FILLIN "Enter month" } { FILLIN "Enter year" } 

 

Select the two fields and insert a bookmark named Month_Year. Then press Alt+F9 once (or maybe twice) so the field codes disappear.

 

At each place in the template where you want the month and year to appear, insert this field:

 

{ REF Month_Year }

 

Save the template and close it.

 

When you create a new document based on the template, these two boxes will appear first:

 

1.png

When the document appears on the screen, the month and year will appear in the FILLIN fields and all the REF fields.

 

If you make a mistake and want to change the date, select the whole document (Ctrl+A) and update its fields (F9).