Posts Tagged 'Word'

Weekly Diary Document

A little while ago, I came across the idea of a PocketMod: a paper organiser which is printed out as a single sheet of A4, and then folded into an 8-page A7 booklet.

pocketmod

There’s a simple utility that converts an 8 x A4 PDF into a 1 x A4 PocketMod sheet (with the correct page orientation for folding). Obviously, the 8 x A4 PDF can be generated from a Word document.

You can design your own PocketMod on the website, but I wanted a simple weekly diary with pages To Do, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday/Sunday, Notes (with the appropriate dates for pages 2-7). So I’ve set up a Word template to generate a series of Heading1s, for a week that you select using a Calendar control. The H1s page break before.

The Calendar form looks like this:

calendarform1

This is just a form with the Calendar control and an OK button (right-click the background of the Toolbox and pick Additional Controls…). The code for the form is simple:

Public Property Get CalDate() As Date
    CalDate = Calendar.Value
End Property

Private Sub OKCommand_Click()
    Me.Hide
End Sub

Private Sub UserForm_Initialize()
    Calendar.Value = Date
End Sub

In the ThisDocument module, we need to trigger the initialization:

Private Sub Document_New()
    SetupHeadings
End Sub

SetupHeadings is the top-level procedure in general module DiaryDoc. This:

  • gets StartDate, using the date from the Calendar form, and making sure that it’s the Monday of the selected week
  • uses AddPara to create an H1 + Normal paragraph, for each page (pages 2-7 inside a For loop)
  • deletes the first paragraph that was created by default when the document opened.

Here’s StartDate:

Function StartDate() As Date
        'Prompt the user for a calendar date.
        'Return the date of the corresponding Monday
        '(preceding if not exact).

    CalendarForm.Show
    StartDate = CalendarForm.CalDate

        'StartDate not a Monday: go back to previous Monday
    Do While Weekday(StartDate, vbMonday) <> monday
        StartDate = StartDate - 1
    Loop

End Function

Here’s AddPara:

Sub AddPara(paratext As String)
        'Adds a H1 paragraph with the given paratext,
        'followed by a Normal paragraph.

    ActiveDocument.Paragraphs.Add
    With ActiveDocument.Paragraphs.Last
        .Range.text = paratext
        .Style = wdStyleHeading1
    End With

    ActiveDocument.Paragraphs.Add
    ActiveDocument.Paragraphs.Last.Style = wdStyleNormal

End Sub

The full module is available on my website (as is the template).

Although not a diary as such, I’m currently using Evernote: a free online/synchronised notebook application. You can create notes from any web page, email or arbitrary selection, with a single click: neat.


July 2014
M T W T F S S
« Dec    
 123456
78910111213
14151617181920
21222324252627
28293031  

Follow

Get every new post delivered to your Inbox.