Conrad Muller
Seattle, Washington

Email: conrad at
dot com

Microsoft Word Application to Generate Form Letters

An exercise for a beginning programming class.

Option Explicit

' Run this procedure when the document opens.
Private Sub document_open()

' Select the current document and minimize it.
ActiveWindow.WindowState = wdWindowStateMinimize

' --------------
' Assigns the module ShowForm() to the shortcut keys Alt+L

' Set the current document as the location of the code to be run.
CustomizationContext = ActiveDocument

' Define Alt+L as the KeyCode in the KeyBindings container.
KeyBindings.Add KeyCode:=BuildKeyCode(Arg1:=wdKeyAlt, Arg2:=wdKeyL), _
KeyCategory:=wdKeyCategoryMacro, Command:="ShowForm" ' Link the KeyCode to the module "ShowForm"
' --------------

' Now load and show the UserForm.

End Sub

' This procedure loads and shows the UserForm "frmSalesLetter"
Sub ShowForm()

Load frmSalesLetter ' Loads the form into memory.
frmSalesLetter.Show ' Shows the form on the screen.

End Sub

Home | Resume | Project Portfolio | Writings | Developer Resources | Contact Form