how do i save only one month at a time in a calendar?

J

Janet

I use the 2009 classic monthly calendar in Word to make our agent floor time
schedule and I want to email each agent the schedule each month without
having to all 12 months each time. I want to send them January's schedule but
not the rest of the months.
 
G

Graham Mayor

Each month of the calendar is a US letter sized page containing a table. The
following macro will export the chosen month to a new document and format
that document similarly. The default will be the current month. Attach it to
a toolbar button (or in the case of Word 2007 to the QAT). You can then do
what you want with the individual month's document. The original calendar is
unaffected and I have included the option to save and close that (remove the
apostrophe from the start of the line).
http://www.gmayor.com/installing_macro.htm

Sub ExportMonth()
Dim sPage As Integer
Dim oCal As Document
Dim oMonth As Document
Set oCal = ActiveDocument
Start:
On Error Resume Next
sPage = InputBox("Which month, 1-12", "Calendar", Format(Date, "M"))
If sPage = "" Then Exit Sub
If sPage > 12 Or sPage < 1 Or IsNumeric(sPage) = False Then
MsgBox "You must enter a number between 1 and 12", vbCritical, "Error!"
GoTo Start
End If
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=sPage
With oCal
.Bookmarks("\page").Range.Copy
'next line is optional
'.Close wdSaveChanges
End With
Set oMonth = Documents.Add
With oMonth
With .PageSetup
.Orientation = wdOrientLandscape
.PageWidth = CentimetersToPoints(27.94)
.PageHeight = CentimetersToPoints(21.59)
.TopMargin = CentimetersToPoints(1.27)
.BottomMargin = CentimetersToPoints(1.27)
.LeftMargin = CentimetersToPoints(1.27)
.RightMargin = CentimetersToPoints(1.27)
End With
End With
With Selection
.Paste
.EndKey wdStory
.TypeBackspace
.HomeKey wdStory
End With
End Sub

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top