Download presentation
Presentation is loading. Please wait.
Published byStella Knight Modified over 9 years ago
1
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
2
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 2 Objectives Unprotect a document Set a security level in Word Crop a graphic Create a new style that is associated with a shortcut key Modify a style
3
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 3 Objectives Modify a drawing object Record and execute a macro Customize toolbars and menus View and edit a macro’s VBA code Insert a VBA procedure
4
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 4 Objectives Run a macro when a user exits a form field Insert an ActiveX control, set its properties, and write its VBA procedure Work with the Protect Document task pane Attach a digital signature to a document
5
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 5 Unprotecting a Document Follow the instructions on pages WD 557 – WD 558 to open Word and save the document with a new file name Click Tools on the menu bar Click Unprotect Document on the Tools menu Click the Close button on the Protect Document task pane title bar
6
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 6 Unprotecting a Document
7
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 7 Setting a Security Level in Word Click Tools on the menu bar and then point to Macro Click Security on the Macro submenu When Word displays the Security dialog box, if necessary, click the Security Level tab Click Medium Click the OK button
8
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 8 Setting a Security Level in Word
9
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 9 Cropping a Graphic Click the Crop button on the Picture toolbar Drag the right-middle cropping handle leftward to the location of the mouse pointer shown in figure 8-9 on page WD 565 Release the mouse button Click the Crop button on the Picture toolbar again
10
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 10 Cropping a Graphic
11
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 11 Creating a Style Associated with a Shortcut Key Click the Styles and Formatting button on the Formatting toolbar When Word displays the Styles and Formatting task pane, click the New Style button When Word displays the New Style dialog box, type DataEntryArea in the Name text box Click the Style type box arrow and then click Character In the Formatting area, click the Font box arrow and then click Century Gothic, click the Font Size box arrow and then click 11, click the Bold button (if necessary), and click the Font Color button arrow and then click Dark Red on the color palette
12
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 12 Creating a Style Associated with a Shortcut Key Click the Format button Click Shortcut key on the Format button menu When Word displays the Customize Keyboard dialog box, press ALT+D If necessary, click the Save changes in box arrow and then click A+ Dentist Locator Revised
13
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 13 Creating a Style Associated with a Shortcut Key Click the Assign button Click the Close button to close the Customize Keyboard dialog box Click the OK button in the New Style dialog box Click the Close button on the Styles and Formatting task pane title bar
14
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 14 Creating a Style Associated with a Shortcut Key
15
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 15 Modifying a Style Click the Styles and Formatting button on the Formatting toolbar When Word displays the Styles and Formatting task pane, if necessary scroll through the list of styles until DataEntryArea appears in the list Right-click DataEntryArea in the list Click Modify in the list
16
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 16 Modifying a Style When Word displays the Modify Style dialog box, click the Font Color button arrow and then click Dark Blue on the color palette Click the OK button Click the Close button on the Styles and Formatting task pane title bar If necessary, scroll to display the entire form in the document window
17
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 17 Modifying a Style
18
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 18 Filling a Drawing Object with a Preset Color Scheme Fill Effect Select the rectangle by pointing to one of its edges and then clicking when the mouse pointer has a four-headed arrow attached to it If the Drawing toolbar is not displayed on your screen, click the Drawing button on the Standard toolbar Click the Fill Color button arrow on the Drawing toolbar and then click the Fill Effects button When Word displays the Fill Effects dialog box, if necessary, click the Gradient tab
19
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 19 Filling a Drawing Object with a Preset Color Scheme Fill Effect In the Colors area, click Preset Click the Preset colors box arrow, scroll to and then click Parchment Click the OK button
20
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 20 Filling a Drawing Object with a Preset Color Scheme Fill Effect
21
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 21 Recording a Macro and Assigning It a Shortcut Key Double-click the REC status indicator on the status bar When Word displays the Record Macro dialog box, type PrintFormData in the Macro name text box If necessary, click the Store macro in box arrow and then click Documents Based On A+ Dentist Locator Revised Select the text in the Description text box and then type Prints only the data on a form Click the Keyboard button
22
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 22 Recording a Macro and Assigning It a Shortcut Key When Word displays the Customize Keyboard dialog box, press ALT+P Click the Assign button Click the Close button in the Customize Keyboard dialog box Click File on the menu bar Click Print on the File menu
23
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 23 Recording a Macro and Assigning It a Shortcut Key When Word displays the Print dialog box, click the Options button When Word displays the second Print dialog box, place a check mark in the Print data only for forms check box Click the OK button in each dialog box Click the Stop Recording button on the Stop Recording toolbar
24
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 24 Recording a Macro and Assigning It a Shortcut Key
25
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 25 Running a Macro Press ALT+P
26
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 26 Adding a Button to a Toolbar Click Tools on the menu bar Click Customize on the Tools menu When Word displays the Customize dialog box, if necessary, click the Commands tab Scroll to and then click Macros in the Categories list
27
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 27 Adding a Button to a Toolbar Click TemplateProject.NewMacros.PrintFormData in the Commands list Drag the selected command in the Commands list to the Standard toolbar between the Print and Print Preview buttons Right-click the button just added to the Standard toolbar and then point to Change Button Image on the shortcut menu
28
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 28 Adding a Button to a Toolbar In the palette of button images, click the button with the image of the text on pages Right-click the button just added to the Standard toolbar Click Text Only (in Menus) Click the Close button in the Customize dialog box
29
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 29 Adding a Button to a Toolbar
30
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 30 Deleting a Button from a Toolbar Click Tools on the menu bar and then click Customize Right-click the button to be deleted, in this case, the Print Form Data button Click Delete on the shortcut menu Click the Close button in the Customize dialog box
31
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 31 Deleting a Button from a Toolbar
32
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 32 Viewing a Macro’s VBA Code Click Tools on the menu bar and then point to Macro Click Macros on the Macro submenu When Word displays the Macros dialog box, if necessary, click the Macros in box arrow and then click A+ Dentist Locator Revised (template) If necessary, click AutoNew in the Macro name list Click the Edit button
33
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 33 Viewing a Macro’s VBA Code If the Code window is not displayed in the Visual Basic Editor, click View on the menu bar and then click Code If the Project Explorer window is displayed, click its Close button If the Properties window is displayed, click its Close button If the Code window is not maximized, double-click its title bar
34
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 34 Viewing a Macro’s VBA Code
35
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 35 Modifying Existing Code Double-click the 6 at the end of the executable code statement above the End Sub statement Type 7 as the new number of lines to scroll
36
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 36 Inserting a Visual Basic Procedure Press ALT+F11 to open the Visual Basic Editor in a new window If the Project Explorer is displayed, click its Close button If the Properties window is displayed, click its Close button If the Code window is not displayed, click View on the menu bar and then click Code
37
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 37 Inserting a Visual Basic Procedure If necessary, double-click the title bar of the Code window to maximize it Click the Insert UserForm button arrow on the Standard toolbar Click Procedure in the list When Visual Basic displays the Add Procedure dialog box, type RatingScaleValidation in the Name text box Click the OK button
38
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 38 Inserting a Visual Basic Procedure
39
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 39 Running a Macro when a User Exits a Form Field Double-click the text form field for the rating scale When Word displays the Text Form Field Options dialog box, click the Exit box arrow and then click RatingScaleValidation Click the OK button
40
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 40 Running a Macro when a User Exits a Form Field
41
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 41 Inserting an ActiveX Control If the Control Toolbox toolbar is not displayed on the screen already, click View on the menu bar, point to Toolbars, and then click Control Toolbox If formatting marks are not displayed on the screen already, click the Show/Hide ¶ button on the Standard toolbar Click the paragraph mark at the end of the form and then press the ENTER key Click the Center button on the Formatting toolbar Click the Command Button button on the Control Toolbox toolbar
42
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 42 Inserting an ActiveX Control
43
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 43 Setting Properties of an ActiveX Control With the command button selected and Word in design mode, click the Properties button on the Control Toolbox toolbar When the Properties window opens, if necessary, click the Properties box arrow and then click CommandButton1 in the list If necessary, click the Alphabetic tab If necessary, drag the right edge of the Properties window to make it wider
44
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 44 Setting Properties of an ActiveX Control In the list, click Caption in the left column and then drag through the value, CommandButton1, to its right Type Click Here When Finished as the new caption Click the AutoSize property Click the AutoSize button arrow and then click True
45
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 45 Setting Properties of an ActiveX Control Click the BackColor property, click the BackColor button arrow, click the Palette tab, and then click Dark Red on the color palette Click the ForeColor property, click the ForeColor button arrow, click the Palette tab, and then click Tan on the color palette Click the Font property Click the button at the right of the Font value box
46
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 46 Setting Properties of an ActiveX Control When Word displays the Font dialog box, scroll through the Font list and click Rockwell; if necessary, click Bold in the Font style list; and then click 12 in the Size list Click the OK button If necessary, click the A+ Dentist Locator Revised – Microsoft Word program button on the taskbar to redisplay the form on the screen Click the Close button on the Properties window title bar
47
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 47 Setting Properties of an ActiveX Control
48
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 48 Entering the Click Here When Finished Button Procedure With Word in design mode, click the Click Here When Finished button and then point to the View Code button on the Control Toolbox toolbar Click the View Code button If the Project Explorer window opens, click its Close button If necessary, double-click the Code window title bar to maximize the window With the insertion point on the blank line between the Sub and End Sub statements in the Code window, type the code statements shown in lines 2 through 15 in Table 8-8 on page WD 611. Make sure you type an apostrophe at the beginning of each comment line. For clarity, indent the code statements as shown in Table 8-8
49
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 49 Entering the Click Here When Finished Button Procedure Verify your code statements by comparing them to Figure 8-68 on page WD 613 Click the Close button on the right edge of the Microsoft Visual Basic title bar to return to the online form Click the Exit Design Mode button on the Control Toolbox toolbar Click the Close button on the Control Toolbox toolbar title bar
50
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 50 Entering the Click Here When Finished Button Procedure
51
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 51 Protecting the Form Using the Protect Document Task Pane Click Tools on the menu bar and then click Protect Document When Word displays the Protect Document task pane, click the Editing restrictions check box, click the Editing restrictions box arrow, and then click Filling in forms Click the Yes, Start Enforcing Protection button and then click the OK button Click the Close button on the Protect Document task pane title bar If necessary, scroll to display the entire form in the document window
52
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 52 Protecting the Form Using the Protect Document Task Pane
53
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 53 Digitally Signing a File Click Tools on the menu bar and then click Options When Word displays the Options dialog box, if necessary, click the Security tab Click the Digital Signatures button Click the Add button
54
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 54 Digitally Signing a File If Word displays a dialog box, warning you about fonts, text, or pictures, click the Yes button When Word displays the Select Certificate dialog box, click the certificate you wish to add. If your computer does not display any certificates, click the Cancel button in each dialog box and skip the next step Click the OK button in each dialog box Click the Save button on the Standard toolbar
55
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 55 Digitally Signing a File
56
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 56 Summary Unprotect a document Set a security level in Word Crop a graphic Create a new style that is associated with a shortcut key Modify a style
57
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 57 Summary Modify a drawing object Record and execute a macro Customize toolbars and menus View and edit a macro’s VBA code Insert a VBA procedure
58
Word Project 8: Working with Macros and Visual Basic for Applications (VBA) 58 Summary Run a macro when a user exits a form field Insert an ActiveX control, set its properties, and write its VBA procedure Work with the Protect Document task pane Attach a digital signature to a document
59
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Complete
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.