Word 2003: Macros and Templates BUCS IT Training TABLE OF CONTENTS WHAT ARE TEMPLATES?..................................................................................................................... 1 HOW CAN TEMPLATES BE USED? .................................................................................................... 1 PRODUCING A TEMPLATE................................................................................................................... 1 USING TEMPLATES ............................................................................................................................... 2 TEMPLATES DIALOG BOX ................................................................................................................... 3 A SELECTION OF THE TEMPLATES AVAILABLE FROM THE WEB............................................. 3 TEMPLATES AVAILABLE WITHIN WORD.......................................................................................... 4 ATTACH A DIFFERENT TEMPLATE TO THE ACTIVE DOCUMENT............................................... 6 HINTS & TIPS FOR TEMPLATES ......................................................................................................... 7 CUSTOMISING TEMPLATES ................................................................................................................ 7 NORMAL.DOT........................................................................................................................................ 10 PROBLEMS CHANGING THE FILE TYPE FROM "DOCUMENT TEMPLATE" TO "WORD DOCUMENT."......................................................................................................................................... 10 WHAT ARE MACROS?......................................................................................................................... 11 HOW CAN THEY BE USED? ............................................................................................................... 11 PRODUCING A MACRO FROM SCRATCH ....................................................................................... 11 EXAMPLE EXERCISE - MACRO TO GIVE FANCY EFFECTS TO TEXT....................................... 13 RUNNING A MACRO ............................................................................................................................ 14 TO DELETE A MACRO......................................................................................................................... 14 ADDING MACROS TO THE TOOL BAR ............................................................................................ 14 TO DELETE A CUSTOMIZED TOOLBAR .......................................................................................... 16 ADDING A COMMAND OR OTHER ITEM TO A MENU ................................................................... 16 RENAMING STYLES, AUTOTEXT ENTRIES, MACROS, AND TOOLBARS................................. 16 VIEWING THE MACRO CODE............................................................................................................. 17 INCORPORATING FILL-IN OR MESSAGE BOXES INTO A MACRO ............................................ 17 TIPS FOR RECORDING A MACRO .................................................................................................... 20 TROUBLESHOOTING MACROS......................................................................................................... 21 HELP ........................................................................................................................................... 23 Author: L.Maskell, IT Trainer Copyright: University of Bath This document can be used for non-profit use by academic institutions provided this copyright statement is included and acknowledged. Please contact the Information Officer, BUCS, University of Bath for further information. What are Templates? A template is a file which contains the blueprint for any documents which you want to create in exactly the same style. Examples are standard memos and report formats. A template contains all the following: • • • • • • • • Styles Page format & margin settings Fonts Formatting Customised menus, formatting & shortcut keys Macros Boilerplate text & graphics Auto Text So that all the above can be applied automatically to all documents of the same type, Word provides some standard templates for you but you can also create your own. What is Boilerplate Text? Boilerplate text is a section of text that will occur many times throughout a document, and which may be subject to several changes before it reaches the final version. It may be added and edited as an AutoText entry, inserted into the document or template as an AutoText field, and is easily updated as a field whenever the text changes. How Can Templates be Used? Once a template is set up and saved into your templates folder it can be accessed instantly by choosing File – New and then choosing the template you want from the Task Pane. • • • Templates can be further modified and resaved as new templates, thus saving time and effort. Templates can be set up to reflect the house style of an institution or department, so that all documents are instantly recognisable and consistent. They can incorporate standard headers and footers and logos, for example, as well as different text styles. Producing a Template 1. Choose File - New and open a blank page. 2. Use File – Page Setup to set up the required page type. 3. Type in the text which you want to appear in the template and format it appropriately. 4. Add any headers or footers including page numbers. 5. Insert index and contents, logos and pictures as appropriate. 6. Save the template using File – Save As. 7. Document Type should be set to Document Template. Word will add a .DOT extension to the file and save it into the Templates folder. Magical Macros & Templates 2003 1 BUCS IT Training Templates you save in the Templates folder appear under the General tab which is displayed when you select File – New. If you want to create custom tabs for your templates in the New dialog box, you will need to create subfolders in the Templates folder and save your templates into these new subfolders. The names you give your subfolders will appear as new tabs. N.B. If you save a template in a different location, the template will not appear in the New dialog box. Example Exercise - Producing a Template for Standard Memos 1. Choose File - New and open a blank page. 2. Type the following memo header into the page: UNIVERSITY OF BATH INTERNAL MEMORANDUM YOUR DEPARTMENT To: From: Subject: Date: CC: 3. Format the memo header as you wish, using colours and adding the University logo at the top. 4. Save the template using File – Save As. 5. Document Type should be set to Document Template. Word will add a .DOT extension to the file and save it to the Templates folder. 6. Click on File - New and you will see an icon for your new memo template. Using Templates • Click on File – New to see the choice of templates available in the New Document Task Pane. • Under the heading New – Click Blank document for a blank page. • Click From existing document to create a copy of that document. • N.B. Although web options are available, within the University, you should be using Dreamweaver if you want to create a web page. • Under the heading Templates – In the Search online for box, enter the type of publication you would like a template for, e.g. party invitation. • Click Templates on Office online to see the full range of online templates available form the Microsoft website. • Click On my computer to open the Templates dialog box. Magical Macros & Templates 2003 2 BUCS IT Training Templates Dialog Box • Remember that any you have added yourself will appear under the General tab. 1. Select the required template by clicking on it and clicking OK. • Notice that the default choice in the bottom right hand corner shows that you will be creating a new document. (If you wish to amend a template you will need to select the other option.) 2. You can now type your new document. 3. When you save the document, notice that the default in the dialog box shows that it will be saved as a Word document. A Selection of the Templates available from the Web • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Staffing and Management Hiring, Managing and Motivating Employees Organisation Announcements Letters to Customers Sales Letters Addressing Complaints Credit and Collection Marketing Brochures, Newsletters, Press & PR Legal Business and Commercial Real Estate and Rental Business Forms Bids and Proposals Invoices and Billing Expense Reports Stationery, Labels and Cards Business Cards, Fax and Transmission Covers CVs, Cover Letters, Resignation Letters Customer Requests, Problems & Feedback Business Calendars, Agendas and Minutes Finance and Accounting Banking and Loans, Financial Statements Investments Publications, Education, Reports, Books & Scripts Templates for Teachers Personal and Community Interests Fundraising, Voicing your Opinion Hobbies and Sports Magical Macros & Templates 2003 3 BUCS IT Training Templates Available within Word Do investigate the many templates which Word makes available for you, including faxes, letters, memos and resumés in a choice of contemporary, elegant and professional styles. Contemporary, Elegant and Professional Contemporary - Documents characterized by Arial and Times New Roman fonts, with grey highlighting applied to headings. Includes a grey “globe” symbol. Elegant – The font used is Garamond and the style is very compact, with thin double lines used at top and bottom of headings. Professional – Characterised by use of Arial fonts and thick, black headings and blocks. Tab Template What it does General Blank document Creates a new document based on the default template quickly – the same as clicking New Blank Document on the Standard toolbar. Web Page Opens a blank Web Page. Pleading Wizard Legal Pleadings Creates pleadings for courts that have different layout and style requirements. You can create an automated template for each one. Letters & Faxes Contemporary Fax Creates a fax in the style called “Contemporary”. Contemporary Letter Creates a letter in the style called “Contemporary”. Elegant Fax Creates a fax in the style called “Elegant”. Elegant Letter Creates a letter in the style called “Elegant”. Envelope Wizard Create one envelope or create envelopes for a mailing list. Fax Wizard This Wizard helps you create a cover sheet and fax a document to someone. Letter Wizard Provides a simple template for one letter or a letter to be sent to a mailing list. Mailing Label Wizard Create one label or a page of the same label, or create labels for a mailing list. Professional Fax Creates a fax in the style called “Professional”. Professional Letter Creates a letter in the style called “Professional”. Magical Macros & Templates 2003 4 BUCS IT Training Memos Other Documents Publications Contemporary Memo Creates a memo in the style called “Contemporary”. Elegant Memo Creates a memo in the style called “Elegant”. Memo Wizard This Wizard creates a memo that is tailored to your preferences, in a choice of contemporary, elegant or professional styles. Professional Memo Creates a memo in the style called “Professional”. Agenda Wizard This Wizard helps you create an organized agenda for your meetings. It gives you a choice of “standard” or “modern” styles, or a chunky style using boxes. It enables you to choose the type of information you want to head the agenda, type in your agenda items, and can also include a form for recording minutes. Batch Conversion This Wizard performs a batch conversion of several files, which you specify, to or from the Word format (e.g. to convert HTML files). Calendar Wizard This Wizard creates a calendar, with an A4 page for each month. Choose from a style with boxes and borders, another with a side banner, or a “jazzy” style. You can add pictures and make the calendar for any range of dates. Contemporary Resume Creates a CV template for you to fill in, in the contemporary style. Elegant Resume Creates a CV template for you to fill in, in the elegant style. Professional Resume Creates a CV template for you to fill in, in the professional style. Resume Wizard Creates a CV that you can tailor to your preferences, in one of the three default styles. Brochure Directory These are only available in Office 2000 Professional. Manual Thesis Magical Macros & Templates 2003 5 BUCS IT Training Reports Contemporary Report For each of these three styles of reports, change the information on the cover page to contain the information you would like. For the body of your report, use Styles such as Heading 1-5, Body Text, Block Quotation, List Bullet, and List Number from the Style control on the Formatting toolbar. Elegant Report Professional Report The report templates are complete with Styles for a Table of Contents and an Index. In addition to producing reports, these templates can be used to create proposals and workbooks. To use the templates, select any paragraph and just start typing. To create your own version of any of these templates, select "template" as the document type when you open the template, then make any changes you require, rename and resave the template. Attach a different template to the active document 1. On the Tools menu, click Templates and Add-Ins. 2. Click Attach, and then select the template you want. 3. Click Open then OK. • You can also copy individual styles from one template to another by clicking Organizer. Tip To use styles from the newly attached template, select the Automatically update document styles check box in the Templates and Add-Ins dialog box. Word adds the styles from the template to the document. If styles in the document and template have the same names, Word updates the document styles to match the template styles. Magical Macros & Templates 2003 6 BUCS IT Training Hints & Tips for Templates Using the Style Gallery You can apply the styles from any existing template to a completely new document by making use of the Style Gallery. 1. On the Format menu, click Theme. 2. Click Style Gallery. 3. In the Template box, select the template that contains styles you want to use. Styles from the template you select are copied to your document. Using Styles • • • To preview how your document will look with the different styles, click Document under Preview. To see a sample document with styles from the selected template, click Example. To see a list of the styles used in the selected template, click Style samples. Using Tables Often the information in a template needs to be kept in columns or needs to be lined up. Use tables instead of tabs as they are easier to manipulate and update. Using Fields Make use of automated fields for information such as date and time, numbering, indexes or fill-in boxes. Customising Templates Changing an Existing Template 1. Choose File - New and click on the template you wish to change. 2. Select Create New Template in the bottom right hand corner. 3. Make any changes you wish to make to the template. 4. Now save the template giving it a new name. Notice that the option to “Save as type” defaults to Document Template. Magical Macros & Templates 2003 7 BUCS IT Training Modifying the Current Template you are Working With If you are working in a document and create an attractive or useful style and suddenly wish you could add the new style to the original template: 1. 2. 3. 4. 5. Select Format-Styles and Formatting. Click the Style you wish to add. Click Modify. Check the box labelled Add to Template. Save the template when prompted to do so and the next time you open it your new style will be available. Copy styles, AutoText entries, toolbars, or macros 1. On the Tools menu, click Templates and Add-Ins. 2. Click Organizer, and then click the tab for the items you want to copy. 3. To copy items to or from a different template or file, click Close File to close the active document and its attached template or to close the Normal template. Then click Open File, and open the template or file you want. 4. Click the items you want to copy in either list and then click Copy. To select a range of items, hold down SHIFT and click the first and last items. To select nonadjacent items, hold down CTRL as you click each item. Note If you copy toolbars to which you've assigned custom macros, you must also copy the macros. Magical Macros & Templates 2003 8 BUCS IT Training Delete multiple styles, AutoText entries, toolbars or macros 1. On the Tools menu, click Templates and Add-Ins. 2. Click Organizer and then click the tab for the items you want to delete. 3. To delete items from a different template or file, click Close File to close the active document and its attached template or to close the Normal template. Then click Open File, and open the template or file you want. 4. Click the items to delete and then click Delete. Tip To select a range of items, hold down SHIFT and click the first and last items. To select nonadjacent items, hold down CTRL as you click each item. What happens to my document if I change its attached template? Changing the template that's attached to a document — either by modifying the currently attached template or by attaching a different template — has the following effects: • Macros, AutoText entries and custom toolbar and command settings in a modified template are available for use in any document based on the template, including existing documents. If you attach a different template to a document, items stored in the newly attached template are then available to the document. • If you add or modify styles in a template, styles in an existing document based on that template are not immediately updated to match the template styles. • To make Word update styles in an existing document to match the styles in its attached template, first open the document. On the Tools menu, click Templates and Add-Ins, and then select the Automatically update document styles check box. If the document text is formatted with styles that have the same names as styles in the attached template, Word updates the text formatting to match the template's style formats. • If you change the boilerplate text and graphics in a template or change document formats, for example, page margins and page size, headers and footers or the number of columns per page, these changes affect only new documents that you subsequently base on the template. Existing documents based on the template aren't affected. Magical Macros & Templates 2003 9 BUCS IT Training Normal.dot This is the default template for all new blank pages created in Word. You can change the defaults by selecting from the Format menu, choosing the item that you want to change (for example Font) and then clicking on Default. These changes will affect all new documents based on the normal.dot template. Tip From the Tools menu, choose Options and go to the Save tab. If you choose the Prompt to Save NORMAL.DOT option, this means that whenever you have made changes in drop down menus, which affect the current template you are working from, you will be prompted to say whether you also want to save those changes to the NORMAL template. The prompt will appear when you exit Word. Problems Changing the File type from "Document Template" to "Word Document." If the file you are saving is a document, not a template, the problem could be the Concept Virus, a macro virus that prevents you from saving a file as any file type other than Document Template. Magical Macros & Templates 2003 10 BUCS IT Training What are Macros? A macro is a series of instructions which run a “mini program”, or sub routine, of the main Word program, in order to perform a series of tasks automatically. Macros are created using the Macro Recorder. This works like a tape recorder. When you have recorded the actions you want to include in the routine, you can stop the recorder and play it back. Behind the scenes, the macro is written in the Visual Basic programming language, but it is not necessary to know this to record a macro - this is generated automatically as you record each task. How can they be used? Macros are used to save time and effort when a standard series of tasks have to be repeated again and again in the course of word processing. Some typical uses of macros might be: • • • • To combine a string of related actions into a single task To speed up editing and formatting To customise an application To bring in data from other applications Producing a Macro From Scratch 1. Create a new document in Word; ensure that a new (clean) document is showing. 2. 3. 4. To start recording the macro, select Tools – Macro - Record New Macro. The Record Macro dialog box will appear. Give the Macro a name. Macro names must start with a letter and cannot include grammatical punctuation like spaces, except for the underscore mark. Note If you give a new macro the same name as an existing macro in Word, the new macro actions will replace the previously recorded actions. 5. Select whether to store the Macro in all documents or only in the document you are working with. 6. In the Description text box, type a brief explanation of what the new macro will do. 7. Having made the appropriate selections in this dialog box, click on OK to begin recording the macro. Magical Macros & Templates 2003 11 BUCS IT Training Assigning the Macro to Toolbars or the Keyboard Within the dialog box, you have a choice whether to assign the Macro to a toolbar or give it a shortcut key. • To assign the macro to a toolbar or menu, click Toolbars. In the Commands box, click the macro you are recording and drag it to the toolbar or menu you want to assign it to. • To assign the macro to shortcut keys, click Keyboard. In the Commands box, click the macro you are recording. In the Press new shortcut key box, type the key sequence. After assigning your macro to the Toolbars or the Keyboard, you will need to click on Close to start recording the Macro. Magical Macros & Templates 2003 12 BUCS IT Training During Recording 1. The mouse pointer will change to an arrow with a cassette on the end and a tiny “Stop Recording” toolbar will appear to show that a Macro is in the process of being recorded. 2. At the bottom of your screen, REC on the Status Bar will appear emboldened. 3. Carry out the actions that you want to record. • 4. You can pause the recording at any time by clicking on the Pause Recording icon on the Stop Recording toolbar so that it is highlighted by a box. To continue recording, click on the button again so that the box disappears. To end the recording, click on the Stop Recording icon (the blue square) on the Stop Recording toolbar. Using the REC Panel on the Status Bar Alternatively, you can double click on the greyed out REC panel on the status bar to quickly display the Record Macro dialog box. When you have finished recording, double click on the REC panel on the status bar again. When the REC button on the Status Bar is greyed out, this indicates that the recording process is no longer taking place. Example exercise - Macro to give fancy effects to text 1. 2. 3. 4. 5. 6. 7. Open a new document in Word. From the Tools menu, choose Macro - Record New Macro. Give the macro the name MyName. In the Description box type “This macro will add my name formatted bold, 24 points, centre aligned and have special font effects.” Click on OK. The macro has now started recording. Type your name. Select the text you have entered by using the keyboard (SHIFT+Home). N.B. In Word, you cannot use the mouse to select text when recording a macro. 8. 9. Format the selected text as bold, 24 points and centre aligned. From the Format menu choose Font then from the dialog box select the Text Effects tab. A list of the different animation effects appears at the top of this box. Select Sparkle Text and then click the OK button. Press the END key to move the cursor to the end of the line. Press the ENTER key to start a new paragraph. Press CTRL+SHIFT+N to remove the formatting and reapply the default Normal 10. 11. 12. 13. style. 14. Press the ENTER key once more. 15. Click the Stop Recording button. Magical Macros & Templates 2003 13 BUCS IT Training Running a Macro 1. Go to the Tools menu and select Macro - Macros. 2. The dialog box lists all the macros you have recorded. As a helpful reminder, the box at the bottom explains what the selected macro will do. 3. Select the macro you want and click on the right hand button marked Run. To Delete a Macro Go to the Tools menu and select Macro - Macros. Select the macro you want and click on the right hand button marked Delete. Adding Macros to the Tool Bar 1. From the Tools menu, select Customise then on the Toolbars tab, click New. 2. Give the Toolbar a name. You can choose whether to make it available to all documents or just the one you are currently working on. 3. Next go to the Commands tab. 4. From the list on the left, choose Macros. Magical Macros & Templates 2003 14 BUCS IT Training 5. A list of all the macros you have recorded appears on the right hand side. Select the one you want to create a toolbar for and then drag and drop it onto your new toolbar. 6. With the dialog box still displayed, right mouse click over the new toolbar. 7. Now you can change the name which is displayed for the Macro by editing it in the Name box 8. Select Change Button Image to put an icon on your toolbar. 9. Close the dialog box. 10. You can now drag and drop the new toolbar onto any one of your existing toolbars. • You can make further changes to your toolbar by selecting Tools – Customise or by right clicking over your toolbar. Magical Macros & Templates 2003 15 BUCS IT Training To delete a customized toolbar 1. From the Tools menu select Customize or right mouse click over the toolbar. 2. Click Delete. 3. Close the dialog box. Adding a Command or Other Item to a Menu 1. If the menu is on a toolbar, show the toolbar that contains the menu you want to add a command or other item to. 2. On the Tools menu, click Customize and then click the Commands tab. 3. In the Categories box, click a category for the command. 4. Drag the command you want from the Commands box over the menu. When the menu displays a list of menu commands, point to the location where you want the command to appear on the menu on the toolbar and then release the mouse. If you don't see the command you want under a particular category, click All Commands in the Categories box. 5. Click Close. Renaming Styles, AutoText Entries, Macros, and Toolbars 1. 2. 3. 4. 5. 6. On the Tools menu, click Templates and Add-Ins. Click Organizer. Click the Styles, AutoText, Toolbars or Macro Project Items tab. In the In box on the left, click the entry you want to rename and then click Rename. In the Rename dialog box, type a new name for the entry. Click OK and then click Close. Magical Macros & Templates 2003 16 BUCS IT Training Viewing the Macro Code If you open a macro in the Visual Basic Editor you can make corrections, remove unnecessary steps, rename or copy individual macros, or add instructions that you cannot record in Word. 1. Select Tools - Macro - Macros to display the Macro dialog box. 2. Click on the right hand button marked Edit. The name of the macro is shown immediately after the word “Sub”. The executing code for the macro is written between the lines beginning “Sub” and “End Sub”. You should only add new code between these lines. Any text which is preceded by an apostrophe is not executable but is a comment (for example your description of what the macro does). If you have Visual Basic Help installed, you can place the cursor in the middle of any word in the code that you are unsure of and press F1 to display the associated Help topic. N.B. Help for Microsoft Visual Basic has to be specially installed from the Microsoft Office 2000 Professional CD. Contact your Departmental Supporter about this. Return to Word by clicking on the Microsoft Word button on the Task Bar, or alternatively click on the Word icon on the Standard toolbar. Incorporating Fill-in or Message Boxes into a Macro InputBox This is used to gather information from the user that will be inserted into the macro code. It appears in the code as: VariableName = InputBox(“Prompt for Information”) where the VariableName is a word chosen by you to store whatever is typed into the InputBox dialog box. Example 1. Choose Tools - Macro - Macros to display the Macro dialog box. 2. Select the MyName macro and click on the right hand button marked Edit. You are now in the Macro code. 3. At the top of the procedure, after the last comment line and before the first executable line, type the following line of code: MyInput = InputBox(“What is your name?”) 4. 5. Modify the next line so that, instead of having your name in quotes at the end, it reads as follows: Selection.TypeText Text:= MyInput Return to Word by clicking on the Microsoft Word button on the Task Bar, or alternatively click on the Word icon on the Standard toolbar. If you run the macro again an input box is produced to allow any person using the macro to enter their own name. Magical Macros & Templates 2003 17 BUCS IT Training MsgBox This informs the user what is going on. It appears in the code as: MsgBox “Information to be displayed” Example 1. Choose Tools - Macro - Macros to display the Macro dialog box. 2. Select the MyName macro and click on the right hand button marked Edit. You are now in the Macro code. 3. Create a blank line before the End Sub line in the code and type: MsgBox “Great Name”, vbExclamation Return to Word by clicking on the Microsoft Word button on the Task Bar, or alternatively click on the Word icon on the Standard toolbar. 4. If you run the macro again a message box is produced after you enter your name. • In both the above examples, any text within the quotation marks may be customised by you. Adding Titles to Input and Message Boxes The code above can be modified to make a title appear on the blue bar at the top of the box. Examples MyInput = InputBox (Prompt:= "What is your name?", Title: = "User Input Required", Default: = "Lydia") In this example we have also added the default entry of Lydia which will automatically appear in the InputBox. MsgBox Prompt:= "Great Name!", Title: = "User Information", Buttons:= vbExclamation Macro to Add Path and File Name to the Title Bar of a Document This macro is available on the Microsoft Product Support pages. You can copy the macro directly from Knowledge Base article number Q209194. To use this macro you will need to modify the default FileSave command by following the steps below. 1. Open a new Word document. 2. From the Tools menu, select Macro – Macros. 3. In the box labeled Macros In, select Word Commands. 4. From the Macro Name list, select FileSave. Magical Macros & Templates 2003 18 BUCS IT Training 5. Go back to the box labeled Macros In and now select Normal.dot (global template). 6. 7. Click Create. In the Visual Basic Editor, add the following macro code to the end of the FileSave macro, so that the finished macro will look like this: Sub FileSave () ' ' FileSave Macro ' Saves the active document or template and adds the path ' and file name to document title bar. ActiveDocument.Save With ActiveDocument .ActiveWindow.Caption = .Path + "\" + .ActiveWindow.Document.Name End With End Sub 8. From the File menu, select Close and Return to Microsoft Word. Magical Macros & Templates 2003 19 BUCS IT Training In future, whenever you save your documents, the file name and path will appear in the title bar of the active document window. Macro to Automate a Template Follow the instructions below to record a macro which automatically creates a new document based on a template. 1. 2. 3. From the Tools menu select Macro – Record New Macro. Name the Macro and make sure it is stored in all documents. From the File menu select New and then open your template. If your template contains dialog boxes, just click on Cancel each time they appear. Stop recording. It is convenient to assign this macro to a toolbar button. 4. 5. Macro to Get Input From an Office Assistant Balloon This cute macro can be found in the Microsoft Knowledge Base in Article number Q222791. It enables you to get the Office Assistant to perform one of five animations. You can create the macro either in a specific PowerPoint presentation or in the global template in Word. http://www.microsoft.com/uk/office/ Tips for recording a macro • Before you record or write a macro, plan the steps and commands you want the macro to perform. If you make a mistake when you record the macro, corrections you make will also be recorded. You can edit the macro later and remove unnecessary steps you recorded. • Try to anticipate any messages that Word might display. For example, if your macro includes a command to close a document, Word asks you to save the document if it contains unsaved changes. To avoid this message, record saving the document before closing it. • If the macro includes the Edit menu command Find or Replace, click More in the Find tab and then click All in the Search box. If the macro searches up or down only, Word stops the macro when it reaches the beginning or end of the document and displays a message asking whether you want to continue searching. • If you want to use the macro you’re recording in other documents, make sure that the macro doesn’t depend on the current document’s contents. • If you use a particular macro often, assign it to a toolbar button, a menu or shortcut key. That way, you can run the macro directly without having to open the Macros dialog box. Magical Macros & Templates 2003 20 BUCS IT Training Troubleshooting Macros A macro I recorded sometimes produces an error message. A macro you record may not run properly in every situation. If the macro cannot run, Word displays an error message. Some macros depend on certain options or settings in Word. For example, a macro that searches for hidden text won't run properly if hidden text isn't displayed. Protection from documents that might contain viruses A macro virus is a type of computer virus that's stored in a macro within a document, template, or add-in. When you open such a document or perform an action that triggers a macro virus, the macro virus might be activated, transmitted to your computer and stored in your Normal or global template. From that point on, every document you open could be automatically "infected" with the macro virus and if other people open these infected documents, the macro virus is transmitted to their computers. “The macros in the project are disabled” message when you run a macro Sometimes, when you try to run the macro in a document, you may receive a message to say that the macros in the project are disabled. This occurs when the macro security level in Word has been set to High (which it is by default). To enable the macros to run, you need to close the document and change the macro security level to Medium. • • • • Select Tools-Options-Macro Security. On the Security Level tab, set security to Medium. Click OK. You must restart Word for the change in security level to take effect. Running Word 2000 macros in Word 2003 Changes in Word 2003 may affect the way your Word 2000 macros run. For example, Templates are located in a different place on your computer, according to whether you are using Word 2000 or Word 2003. Security levels in Word Microsoft Word offers the following levels of security to reduce the chances that macro viruses will infect your documents, templates or add-ins. To set the level of security, go to Tools – Macro – Security. • High You can run only macros that have been digitally signed and that you confirm are from a trusted source. A digital signature causes Word to display a “certificate” on your computer which verifies that the macro has come from a trusted source. Unsigned macros are automatically disabled, and Word opens the document without any warning. Magical Macros & Templates 2003 21 BUCS IT Training • Medium Word displays a warning whenever it encounters a macro from a source that is not on your list of trusted sources. You can choose whether to enable or disable the macros when you open the document. If the document might contain a virus, you should choose to disable macros. • Low If you are sure that all the documents and add-ins you open are safe, you can select this option. It turns off macro virus protection in Word. At this security level, macros are always enabled when you open documents. When you open a template or load an add-in that was already installed when you installed Word 2000, macros within the file are automatically enabled. You can make Word warn you about previously installed templates and add-ins by deselecting the box on the Trusted Sources tab. Magical Macros & Templates 2003 22 BUCS IT Training Help! Congratulations on completing the course! We hope that you both enjoy and benefit from the new skills you have learned. If you encounter difficulties and do not seem to be able to find a solution either from this manual or the online help available to you, then try contacting the BUCS User Support Team. You can obtain help from this fantastic and free service by contacting them in one of the following ways. • Turn up in person at the BUCS Help Desk, Library and Learning Centre • Telephone Extension 3535 • Go to www.bath.ac.uk/bucs/problem Special Help and Support Now you have attended a course, you may phone up in advance to book a session with a Helpdesk adviser on a one-to-one basis. They are not able to offer you a training session, but will answer specific questions and give help with problems you have encountered in the course of using the software. We look forward to seeing you on more courses in the future! BUCS IT Training Magical Macros & Templates 2003 23 BUCS IT Training