top of page

39. Auto-Assemble a Document from a Custom Button-bar Button

Description

How to add a button to your word processor's button bar that will automatically launch a given template for assembly. Instructions are also included for creating a menu item or a Windows shortcut.

Code

Macro Code for Microsoft Word:

(Windows 9x)

Sub Fax_Cover()
Dim RetVal
RetVal = Shell("c:\windows\system\hd5start.exe /tf=c:\hotdocs\templates\faxcover.dot /aa", 1)
End Sub


(Windows NT/2000)

Sub Fax_Cover()
Dim RetVal
RetVal = Shell("c:\winnt\system32\hd5start.exe /tf=c:\hotdocs\templates\faxcover.dot /aa", 1)
End Sub


Explanation
The above script is for a macro I wrote that launches my fax cover sheet template and asks all questions (/aa). The /tf switch allows you to designate a template to launch. After you write this macro, you can stick it on a toolbar or into a menu (in Word, go Tools, Customize, Commands, then click on Macros and drag your macro up to a toolbar).

Code
Windows Shortcut (for the Desktop or Start Menu):

(Windows 9x)

c:\windows\system\hd5start.exe /tf=c:\hotdocs\templates\faxcover.dot /aa


(Windows NT/2000)

c:\winnt\system32\hd5start.exe /tf=c:\hotdocs\templates\faxcover.dot /aa

Explanation
You can also create shortcuts on the desktop or in the Windows "Start" menu that function the same as the word processor macros described above. Create a new shortcut (right-click on the desktop and choose "New", "Shortcut"), and insert/paste the above text as the command line of the shortcut.

Explanation

bottom of page