Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Jan 2003
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    date field in template (Word 2002 SP 2)

    I'm trying to make a template for a course syllabus. I'd like to be able to have entries like:

    Thursday September 4
    Readings:

    Tuesday September 9
    Readings:

    Thursday September 11
    Readings:

    etc.

    My question is: what sort of field(s) can I insert in my template to be able to create entries for, say, every Tuesday and Thursday between September 1 and December 15?

    Ideally I'd like to be able to use this template over the years, and my class schedule will be different every semester, so the best possibility would be one where I could simply input the days of the week that I teach, and the start/end dates of the semester, and have it propagate an entry for each class, but perhaps this is beyond the capacity of Word?

    Many many thanks for any suggestions or advice,
    regards,
    Abe Zablocki

  2. #2
    Lounger
    Join Date
    Dec 2002
    Location
    Hull, Yorkshire, England
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: date field in template (Word 2002 SP 2)

    Hi Abe,

    I don't know how to do it with fields, but a small macro like the following may give something like what you want.

    <pre>Sub TeachingDates()
    Dim StartDate As Date
    Dim EndDate As Date
    Dim DatePtr As Date
    Dim TeachingDays As String

    StartDate = InputBox("Please enter start date (e.g. 01/09/2003)")
    EndDate = InputBox("Please enter end date (e.g. 15/12/2003)")
    TeachingDays = InputBox("Please enter teaching days (Sun = 1) (e.g. 35)")

    For DatePtr = StartDate To EndDate
    If InStr(1, TeachingDays, Weekday(DatePtr)) Then
    Selection.TypeText Format(DatePtr, "dddd mmm d") & vbCrLf & _
    "Readings:" & vbCrLf & vbCrLf
    End If
    Next
    End Sub</pre>



    Regards.

    Ed

  3. #3
    Star Lounger
    Join Date
    Jan 2003
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: date field in template (Word 2002 SP 2)

    Hi Ed,

    Wow, fabulous! (I wish I knew how to write stuff like that).

    Forgive my ignorance, but how do I put this code into my document. I tried Tools-Macros, but couldn't find any option to create a new macro and insert the code.

    Thanks in advance,
    Abe

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: date field in template (Word 2002 SP 2)

    Apparently, Ed's not online now. First, I'd create a new template to use as a global template to hold my macros. Without going into reasons, you may find that better than placing macros in normal.dot.

    1. Go to File/New & select the template radio button.
    2. Save the template & give it a name like global or macro or whatever you prefer.
    3. With that template open, press Alt+F11. The VB editor will open.
    4. Press F7 to open a code window on the right.
    5. On the left, right click either "this document" or "the templateproject" & choose insert/module. You can rename this module (module1) to something meaningful.
    6. Then, on the right side, paste the code. Save the template.
    7. Take a look at Tools/Options/File Locations & see where your startup folder is. If you click "Modify" you can even copy the path to the clipboard. But don't change anything.
    8. Close Word & use Explorer to open the startup folder & the templates folder (where your new template is). You can also do so by going to Start/Run & pasting in the path that you copied & pressing <Enter>.
    9. Move the template to the startup folder & restart Word.

    You'll now find the macro listed if you press Alt+F8.
    Hope this helps,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •