Notes on using MS Word--including shortcuts, templates, styles, themes, images, macros. msword.txt last modified 5/13/2014 This file is from http://archivehistory.jeksite.com/download/download.htm. This was developed for Word 2007. KEY THINGS Word keeps formatting info in the paragraph or section marker at the END of the paragraph or section (not the beginning). When cutting etc. be aware of this. When a section marker is removed, the section gets the formatting of the next section (not the previous section). The Office button in the upper left is clicked to open, save, or print documents, and to access the Word options or preferences. Eg., Office> Print. JK CUSTOM SETTINGS Ctrl-/ -Show paragraph markers, sections, page breaks, etc. Ctrl-< -Makes first line of paragraph have no indent. Ctrl-> -Makes first line of paragraph have .2 inch indent. Ctrl-Up and Down arrows -make upper and lower case and advances cursor. Ctrl-5 (number key pad) -Go to the end of the paragraph. Ctrl-Shift-5 (number key pad) -Select paragraph. Ctrl-Shift-. -Select to end of sentence inside the period. Ctrl-2/3/4/6/7/8/9/0 -Set space after paragraph in points. 7=add 6, 8=12 Alt-2/3/4/6/7/8/9/0 -Set space before paragraph in points. 7=add 6, 8=12 Ctrl-Alt-Enter -Combine the next paragraph or manual line break Ctrl-Alt-PgUp/PgDn -Delete previous/next manual page break Alt-Shift-Home/End -Go to previous/next section break Quick Access Tool bar at has icon for TOC_for_HTML macro that makes a TOC (table of contents) at the end of the document using style Header 2 and then outputs a Filtered HTML file. (Use with Alt-G macro in UltraEdit to select the main text for copying to another HTML file and Alt-F macro for selecting HTML in other file to remove.) Made custom template Book1 and associated styles and style sets for working with a book that will be printed and put on web. Added Theme font Book1 with Adobe Gothic Standard B for headings and Charter BT for body. Under Developer> Templates the checkbox for "Automatically update document styles" was cleared. Default settings made to normal template. Under Advanced> Layout Options (at bottom) Check - Do full justification like WordPerfect 6.x for Windows (justifies by reducing as well as increasing space between words) - Don't use HTML paragraph auto spacing STANDARD FORMATTING SHORTCUTS Center paragraph Ctrl-E Left justify paragr. Ctrl-L Right justify paragr.Ctrl-R Justify paragraph Ctrl-J Single space line Ctrl-1 Increase font 1 pt Ctrl-Shift-> or Ctrl-] Decrease font 1 pt Ctrl-Shift-< or Ctrl-[ Delete previous/next word Ctrl-Backspace/Delete Select next/prior paragraph Ctrl-Shift-Up/Down Arrow Nonbreaking hyphen Ctrl-Shift-Hyphen Nonbreaking space Ctrl-Shift-Space . . . Use nonbreaking spaces between periods Em dash Alt-Ctrl-Minus Sign on Keypad (parenthetical--no spaces) En dash Ctrl-Minus Sign on Keypad (range 1-10) Manual line break Shift-Enter (does not start new paragraph) Copyright symbol Alt-Ctrl-C Registered trademark Alt-Ctrl-R Ellipses (...) Alt-Ctrl-. (do not use for books) Underline words not spaces Ctrl-Shift-W Create hanging indent Ctrl-T Apply normal style Ctrl-Shift-N Apply heading style 1 Alt-Ctrl-1 same for 2, 3 etc. Force justification of the last line on a page Shift-Enter at end of line. Remove formatting (set to default Normal style): Home> Clear Formatting (button) or Home> Styles (lower right button)> Clear All Remove any manual modifications and reset to assigned style: select text, then Ctrl-SpaceBar Remove some paragraph formatting(e.g., lists, borders): Ctrl-Q CONTROL SHORTCUTS Display codes for paragraphs, spaces, page breaks, index flags Home> Paragraph paragraph button Toggle display of formatting Shift-F1 Toggle display of table of contents and other field codes Alt-F9 Values such as page numbers do not display when codes display. LAYOUT AND FORMATTING Sections are used to define different layouts such as headers and footers. Section breaks are inserted with Page Layout> Breaks> Section Breaks. Section breaks can be seen with the draft view (View> Draft or icon on bottom right of window). Can delete sections from the draft view or with Replace (tap Special button for searching for sections). The layout settings in a section are determined by the section marker at the end of the section (rather than at the beginning). Styles are efficient to use and are particularly valuable when a document will be output to multiple formats (e.g., print and web) or may need to have formatting and/or font systematically changed. Layout and formatting are handled with 4 levels, templates, styles, style sets, and themes. The specifications for these are kept in separate files and the locations of the files are given later. By default, the specification files are kept separately for each user. Template - holds the initial default formatting settings for a document, including fonts, margins, styles, and macros. The system default template is normal.dotx (x if no macros in the template and .dotm if macros). Custom templates can be made. Templates are created, modified, etc. with the usual New or Open commands and then select the Template option in the right column. Even when a custom template is used, macros are available from the normal template. Select a template for a new document with New>My Templates. Then select the relevant template and click Ok with the Document button checked. Styles - specify format properties (font size, line spacing, etc.) that are used together. By default there are built-in system styles for Normal for paragraphs, Heading 1, Heading 2, etc. The styles in the template at the time the document is created are copied to the document. The document styles are not updated automatically if the template styles are updated later. Custom styles can be made. Quick Styles are given as Icons under Home>Styles. Click a paragraph or select text and then click a Quick Style icon to apply the style. The built-in system styles cannot be deleted but can be modified. Custom styles can be made by modifying an existing style or creating a new style. Right click a Quick Style icon and select Modify to change a style. The change can be applied to just the document or to the original template that will apply to other new documents. A checkbox on the Modify dialog box determines that. For a new style, Home> Styles (lower right icon to show list)> New Style (icon at bottom NOTE: The font used with a style can be set to be fixed or can be set to use the font specified in themes. When selecting a font from the main style modification dialog box, the options at the top of the list with (Body) and (Heading) should be selected to have the font change as Themes and Fonts are changed. Selecting one of the other fixed fonts will make the font fixed and not variable. NOTE: Each modification of a style is kept as a separate style, which can quickly result in a lot of junk in the styles in a doc or template. Style Sets - specify a group of styles that are used together -- and are displayed as Quick Style icons. Style Set specifications are not stored in the document or in templates. They are used by a specific user. The styles with specific format settings are stored in the document and template, but the Style Set definitions used to apply the styles are stored in a separate file on the computer. A given style (Normal, Heading 1, etc.) can have different settings in different style sets. The applicable style set is selected with Home>Change Styles> Style Sets. Word has various built-in Style Sets and custom ones can be added. Custom Style Sets are made by modifying the Styles as described above and then Home> Change Styles> Style Sets> Save as Quick Style Set. Give the Set a name. A Style Set can be revised by overwritting it. NOTE: changes to a Style Set must be written to the Style Set -- modifications to a Style are not automatically transferred to the Style Set specification file. Themes - Are sets of font types, colors, and graphics effects that can be applied to the styles in a document. These do not change the line spacing, fonts size, etc. Themes are selected and managed under Page Layout> Themes. Many themes come built-in. Custom themes can be developed. Separate buttons can be used to set fonts, colors, and effects. Then the Themes> Save Current Theme can be used to define a new theme. Themes can only be used with .docx files (not .doc). A default Style Set and Theme can be assigned for a template that will be used for a new document. Click Home> Change Styles> Set As Default. Attaching a different template and/or styles - The template and styles attached to a document can be changed with: - Developer> Templates. Then click the Attach button and select a template. To show the Developer tab, Office> Word Options> Popular> Show Developer tab in the Ribbon. - The styles in the document need to be reset from the new template. Home> Change Styles> Style Sets> Reset to Quick Styles from Template. - It is safest to specify a Style Set after the styles have been reset. Home> Change Styles> Style Sets>. - The Theme also needs to be set. Layout> Themes. NOTE: under Developer> Templates the checkbox for "Automatically update document styles" should be clear. Headers and Footers - To put a chapter heading or document title etc. in a header or footer, place the StyleRef field code at the location and assign it the style used for the heading etc. For a page, the previous text with that style will be entered at the field code. Double-click a header or footer to activate the Header & Footer Tools tab. Click the tab and then click Quick Parts> Field> StyleRef. Then select the relevant style from the list. The content of the field on a page will change if the previous text with that style changes. Hyphenation - Hyphenation is handled under Page Layout> Hyphenation. The basic choices are to automatically hyphenate the entire document, or have no hyphenation, or to select an area of the document and manually hyphenate that area. The manual option shows each possible hyphenation and asks what you want to do. Setting no hyphenation does not remove the manual hyphens once assigned, but those can be removed by deleting them--either directly or with a search and replace (Home> Replace> Special> Optional Hypthen). Hyphenation can be controlled with Page Layout> Hyphenation> Hyphenation Options. Setting hyphenation zone to about .5 gives good results. The larger the zone, the fewer lines get hyphenated. Advanced Methods - The order of Quick Style icons is set with Home> then click the lower right expansion icon, then click the bottom buttom for Manage Styles. The Recommended tab is used to set priorities to order diplay of Quick Style icons. The styles in a document can be set back to the styles in a template with Home> Change Styles> Style Sets> Reset to Quick Styles from Template. Styles and macros can be copied between templates and documents and/or deleted using the Organizer. Developer> Templates> Organizer. The files to be processed can be selected by clicking a Close File button and then clicking the resulting open file button. If a style is modified while editing document A and the change should be applied generally, save the modified style to the template. Save the Style Set also because that links the style to the Quick Style icons. Then to apply the style to existing document B, open document B and reset the styles from the template as described above. HTML OUTPUT The Filtered HTML output has the least amount of formatting and junk. Sections or parts of an HTML output file can be pasted into another HTML file and the styles defined in a CSS using the style names created in Word. NOTE that this is HTML and is not XHTML. It is by far easiest to make the web page HTML instead of trying to convert the Word HTML to XHTML. By default Word uses a Windows character set instead of UTF-8. Change the HTML character set with Office> Word Options> Advanced> Web Options (button at the bottom)>Encoding. Then set the encoding pick-list to Unicode (UTF-8). Do this to the normal template as described above to make it the default. Do NOT check the checkbox for "Always save Web pages in the default encoding." NOTE that the character set specified in the template is used even with existing documents -- apparently it is determined by the normal template and not stored in the document. Headers and footers are not put in the HTML output. But headers and footers are put in pdf output -- so headers can be used to make a title that will be put in a pdf output but not in HTML output for the same document. Make a header with Insert> Headers. When a header is open, Design> Different First Page can be checked to make the header only appear on the top of the first page. HYPERLINKS Add hyperlinks by placing cursor at the location, then Insert> Hyperlink. Edit hyperlinks by Insert> Hyperlink while cursor is on the hyperlink. To make a link open in a new browser window, when creating or editing a hyperlink, click Target Frame button and then select New Window. (DO NOT set checkbox for Set as default for all hyperlinks. I had problems with that.) This adds \t "_blank" to the end of the hyperlink field and it gets converted to target=_blank in the output HTML. Can do Alt-F9 to show fields and type or paste \t "_blank" right into the field. A bookmark becomes an html link anchor in an output html file and can be used to link to a specific point in a document. A bookmark is made and inserted with Insert> Bookmark. The bookmark dialog box that comes up shows the defined bookmarks and can be used to add, delete, or go to bookmarks. IMAGES Can Link or Insert images. The image is put at the location of the cursor when linked or inserted. Linked images are kept separate from the document and are not changed when the document is saved -- but the images must be kept in the specified location. Linked images have the link specified in filtered html output. Inserted images are reduced in size and put in a system defined separate folder when filtered html is made. Links have the full path specified by default rather than relative paths that are needed for making web pages. To get images linked with relative path, use a Word field and then reset the path. At the point in document for the picture, insert Includepicture field with Insert> Quick Parts> Field. Select Includepicture and check checkbox for "Data not stored with document." Then type in relative path to the image. e.g., ./imgs/test.jpg for file test.jpg in imgs subfolder of default folder. Note is ok to use / instead of \ for path. Use Alt-F9 to toggle between showing picture and codes. When document is saved, the full path will be inserted in the field. However, re-open the file and edit the path to reset it to the relative path (just type in the field). The relative path will stay after that. And the html output will nicely use the relative path. Check links for linked images with Office> Prepare> Edit Links to Files. Add Alt text to an image (used by search engines and when images are not displayed) by right-clicking on image, then Format Picture, then Alt Text. This will be included in output HTML but does not show in the Word field. If paragraph line spacing is set to Exactly, an image will be cutoff at the height of the line if the image is set to be In Line with Text. Use At Least or one of the other line space settings. To get images in text to look ok in html and in print, use 3 lines (paragraphs) before and after the image. Each paragraph is set to single space, no indent, and 0 points before and after. At the top make the 3rd line-paragraph have a border on top. On the bottom, make the first line-paragraph have a border on the bottom. The bottom 3 lines will be after the figure caption. By default Word compresses image files when they are saved. This reduces the resolution to 220 ppi or less. This can be turned off (or on) for an individual image, or for a document, or for the default for new documents. - for an individual image, click on one or more images to select them. A Pictures Tools tab wil appear, with a tool bar. On the left is a Compress Pictures button. Clicking it brings up a dialog box with an Options button. Click it and then clear or set the checkbox for compress on save. - for a document, click the usual Save As and select the output type. On the dialog box for setting the folder and file name, click the Tools button on the lower right. This brings up the same dialog box as above, but it applies to the document. - for the default for new documents, the template for the document needs to be changed. Typically this will be normal.dotm. Open this by clicking the usual Open file command and select Templates at the top. Open the template and go through the process above for Save As. This will apply to any file using the template. Clicking on an image adds the Picture Tools Format tab that allows placement and modification of the image. Position button allows changing postion of image and whether the image is placed relative to a paragraph, margin, page, or column. Positions> More Layout Options gives the most precise control, but may need to click one of the With Text Wrapping icons first to allow the layout options to be used (they may be greyed out until that is done). On the left are buttons to adjust the brightness or contrast of the image. The Absolute positions are measured related to the location where the cursor was when the picture was added. That location is shown with a small anchor icon that is displayed when the Home> Paragraph formatting display button has been clicked. The anchor can be dragged to a new location and also moves when the picture is moved by dragging. If a picture pops up on the wrong page, the anchor may need to be moved to the right page. NOTE: Modifying the contrast or brightness of an image in Word converts a grayscale image to a color image. TOC -- TABLE OF CONTENTS Word can make a TOC from styles in the document or manually. Using styles is the most efficient, particularly when many revisions are expected. The specific styles that are included can be selected. The TOC can use hyperlinks rather than page numbers. Hyperlinks are needed for html output. Place the cursor where the output TOC is wanted. Can be at the end of the doc. Reference> Table of Contents> Insert Table of Contents is the starting point for custom TOCs. Clear the checkbox for Show page numbers and check the checkbox for Use hyperlinks instead of page numbers. Click the Option button and select which styles to include in the TOC. Make the TOC Level column blank to exclude a style and give it a number to include it. E.g. Heading 2 set to 1 makes a TOC of just the heading 2s. Click Ok and return to the main TOC dialog box. Make sure General Formats: From Template is selected. Other settings will cause the fonts to be specified for HTML output. Reference> Update Table updates the TOC if changes have been made. With these settings, the TOC will be handled as HTML links in a Filtered HTML output file. NOTE that the actual codes identifying hyperlink targets in the TOC are changed each time a TOC is created or updated. If html is being pasted into another html file, the entire file must be updated if the TOC is updated. INDEXES - handled under Reference tab. Markers shown with paragraphs above. MISCELLANEOUS Word 2007 Home edition does not have all the fonts that come with the standard or professional versions of Word. Some of the fonts in Themes are not installed, such as Perpetua, Gill Sans MT, etc. These fonts are switched to something else when applied. =rand(12,10) typed into a Word document generates filler words for 12 paragraphs with 10 sentences per paragraph. This can be used to check formatting. Word 2007 does not run as an administrator by default. Sometimes it is necessary to run as an administrator to make changes such as removing add ins. To run as administrator (on a 64 bit Windows 7 system), go to C:\Program Files (x86)\Microsoft Office\Office12 and right-click on the file Winword.exe. Then select the option "RUN as administrator". FILE LOCATIONS AND CHANGING An easy way to delete, rename, or copy templates, style sets, or themes is to go to the Open or Save dialog box and right click on a file. The safest way to rename a file is to copy it with a new name and then delete the old file. The best practice is to make backup copies of custom templates, style sets, and themes. Templates (normal and custom) are in folder: C:\Users\user name\AppData\Roaming\Microsoft\Templates Style Sets (custom) are .dotx file in folder C:\Users\user name\AppData\Roaming\Microsoft\Quickstyles Themes (custom) are in folder C:\Users\user name\AppData\Roaming\Microsoft\Templates\Document Themes MACROS Ctrl-Break (sometimes labelled as Pause) halts execution of a macro. Macros are stored in templates (normally normal.dotm) so custom macros are backed up when templates are backed up. Easiest to work with macros under the Developer tab. Some macros can be made by recording keystrokes. Others require programming. The examples below are cases that require programming or are much easier with programming. Keybaord shortcuts (hot-keys) can be assigned to macros from: Office> Word Options> Customize> Keyboard Shorcuts button. Then select Macros form the Categories in the left column. Select a macro from the right column and then assign a key combination. DISPLAY DOCUMENT PATH AND NAME IN TITLE BAR To display the path and file name in the Word title bar (not just the file name), make a macro named AutoOpen and put the following command in it. This applies when an existing file is opened. ---------------------------------------------------------------- ActiveDocument.ActiveWindow.Caption = ActiveDocument.FullName ---------------------------------------------------------------- SET SPACING BEFORE AND AFTER PARAGRAPH (efficient to set macros to hotkeys) To set the spacing after the current paragraph to 4 points, make a macro with the following command. ----------------------------------------------------------------- Selection.Paragraphs.SpaceBefore = 4 ----------------------------------------------------------------- To increase the spacing before the current paragraph by 6 points: ----------------------------------------------------------------- Selection.Paragraphs.SpaceBefore = (Selection.Paragraphs.SpaceBefore) + 6 ----------------------------------------------------------------- DELETE NEXT MANUAL PAGE BREAK To remove the next manual page break and combine pages: ----------------------------------------------------------------- With Selection.Find .Text = "^m^p" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceOne End With ---------------------------------------------------------------- To make it apply to the previous page break, instead of .Forward = True, use .Forward = False SAVE AS IN MACRO Save As recorded in a macro hard codes the specific file name and path. To make the macro work with other files, need to change the macro programming to use the default active document name and path. The output file type is specified in the recorded macro, but the name of the output file needs to have the correct filename extension. An example of the programming for outputting a document to Filtered HTML is given below (adapted from example in Word help). NOTE this macro gives an error if the filename has not been defined yet, as when a new document has been created but not yet saved. The Word help gave other programming to handle that case, which is not implemented below. ----------------------------------------------------------------------------- ' put current file name and path in a variable strDocName = ActiveDocument.FullName ' Strip off extension and add ".htm" extension intPos = InStrRev(strDocName, ".") strDocName = Left(strDocName, intPos - 1) strDocName = strDocName & ".htm" ' output filtered html file with new filename in same folder ActiveDocument.SaveAs FileName:=strDocName, FileFormat:= _ wdFormatFilteredHTML, LockComments:=False, Password:="", AddToRecentFiles _ :=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _ :=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _ SaveAsAOCELetter:=False ----------------------------------------------------------------------------- ACCEPT ALL REVISIONS THAT ARE DELETES ----------------------------------------------------------------------------- ' When using change control, this goes through the entire document and accepts ' all revisions that are deletes, but leaves any other revisions. Dim revdel As Revision For Each revdel In ActiveDocument.Revisions If revdel.Type = wdRevisionDelete Then revdel.Accept End If Next ----------------------------------------------------------------------------- TOC FROM HEADINGS Trying to make a macro that would make a TOC using only style Headings 2 did not work. The recorded macro appeared to be correct but it put all style heading levels in the TOC. Had to modify as below to get it to work (changes were UseHeadingStyles:=True, LowerHeadingLevel:=2, UpperHeadingLevel:=2) ----------------------------------------------------------------------------- ' make TOC with style heading 2 only and set as TOC level 1 With ActiveDocument .TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _ True, UseHeadingStyles:=True, LowerHeadingLevel:=2, _ UpperHeadingLevel:=2, IncludePageNumbers:=False, _ AddedStyles:="Heading 2,1", UseHyperlinks:=True, _ HidePageNumbersInWeb:=True, UseOutlineLevels:=False .TablesOfContents(1).TabLeader = wdTabLeaderDots .TablesOfContents.Format = wdIndexIndent End With ----------------------------------------------------------------------------- REMOVE ALL USER ADDED STYLES ----------------------------------------------------------------------------- For Each sty In ActiveDocument.Styles If sty.BuiltIn = False Then sty.Delete Next sty ----------------------------------------------------------------------------- COMBINE PARAGRAPHS OR LINES To combines paragraphs or lines separated with manual line breaks, the macro finds next paragraph marker or manual line break, whichever is first, and replaces it with a space. ---------------------------------------------------------------------------- ' if on a paragraph marker or manual return, move left one char so will ' get it in find. vbCr=ascii 13=paragraph marker, ascii 11=manual return If Selection.Text = vbCr Or Selection.Text = Chr(11) Then Selection.MoveLeft Unit:=wdCharacter, Count:=1 End If ' select to end of paragraph Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend ' search within the selected paragraph for a manual return (^l) Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "^l" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With isfound = Selection.Find.Execute If isfound = True Then ' Delete manual return and put in a space Selection.Delete Selection.InsertAfter (" ") Else ' find and remove paragraph marker (re-finding avoids problems if end of doc) With Selection.Find .Text = "^p" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceOne End With ' add space if not at another end of line marker If Selection.Text <> vbCr And Selection.Text <> Chr(11) Then Selection.InsertAfter (" ") End If End If --------------------------- For these and other macros that are useful when extensive format changes are needed, see documents about ABBYY FineReader at: http://archivehistory.jeksite.com/download/download.htm [printed Courier New 10 pt]