You probably want to add some error handling as well to make sure that the temporary style used is finally removed from the document. ORange.Paragraphs(1).Style = ActiveDocument.Styles("Body Text,bt")ĪctiveDocument.Styles("_TEMP_STYLE_").Delete ' complete paraphraph with the desired style ' search for all occurences of the temporary style and format the Style = ActiveDocument.Styles("_TEMP_STYLE_") To edit the header or footer after placing it, just double-click it on the. You can select one of these now to add it to your document if youd like. On the menu, youll see different header and footer styles that you can use as a starting pointall are fully editable. Selection.Style = ActiveDocument.Styles("_TEMP_STYLE_") Its in the 'Header & Footer' panel at the top of Word. ' apply the temporary style to the discontiguous selection If applying the style only to part of the paragraph (by making it a linked style) is not what you want you probably have to come up with a hack like this: Sub BodyTextApply()Ī "_TEMP_STYLE_", wdStyleTypeCharacter The MSDN article Limited programmatic access to Word discontiguous selections gives some more details. Programmatic access to discontiguous selections is very limited, and such selections can only be created using the Word UI. Make sure the complete paragraph is selected or, if the style should only be applied to part of the paragraph, make your style "Body Text,bt" a linked (paragraph and character) style. However, in your screenshot there is only part of the second paragraph selected. That means it will only be applied to a complete paragraph. Open the Manage Styles dialog again, and check the numbers down the side of the styles list.Looks like your style "Body Text,bt" is a pure paragraph style. NOTE: If, when you do this, you find the style does not appear in the position you expected, it may be because several styles have the same position number, and Word has got confused. Ĭlick OK and the Quote style should now be the fifth one in line in the Styles Gallery.
#Using styles in word 2007 code#
Old time BASIC programmers might remember doing similar things with code line numbers back in the Stone Age. Otherwise you might be stuck t ediously renumbering existing styles to make a gap in the style gallery order.
![using styles in word 2007 using styles in word 2007](https://i.ytimg.com/vi/B6MdL3oSRkA/hqdefault.jpg)
TIP: Leave gaps in the numbering so that future styles have a place to go. We chose ‘5’ but any value from 5 to 9 would put the style in the same position. W e want the Quote style in fifth position, so we enter 5 then click OK.Īt the bottom of the dialog, we can also select whether you want this change to apply only to this document, or to all documents that use the same template.Īs you can see, the top four values are taken. We have decided that apart from the Normal style, we will commonly be using three levels of headings, and that quotes are our next most commonly used style after that. Figure A shows the New Styles button in Word.) Figure A. Click the New Style button in the Task Pane. When you have found the style, choose Move Up, Move Down or Make Last.įor larger jumps in position (like moving Quote at 99 to a better position) select it and click Assign Value.Įnter the number for the position you want the style to appear in the gallery. In Word 2007, click the Styles dialog launcher in the Styles group of the Home tab. Style Sort Order controls the position in the Style Gallery. (Use the Sort Order dropdown and the Show Recommended Styles Only checkbox to sort and filter the list if necessary. On the Recommend tab, find the style that you want to move. G o back to the Styles pane and click the Manage Styles button at the bottom. If you thought it would be a simple ‘drag and drop’ you’ll be disappointed. Now if you drop down the Style Gallery, you should see your chosen style.Ĭhanging the Order of the Styles in the Style GalleryĬ hang ing the order of the styles in the gallery is a little more complicated. Hover over the style, click the arrow that appears, and select Add to Style Gallery.
![using styles in word 2007 using styles in word 2007](https://www.word07.com/images/styles.jpg)
Once you have added the style to the Styles pane, you can now add it to the gallery. Under Select Styles to Show, you can now select either All Styles, or if you have already used the style, select In Use or In Current Document to only show your currently used styles in the Style pane. If the style you are looking for doesn’t show in the Styles pane, click Option s at the bottom of the pane.
![using styles in word 2007 using styles in word 2007](https://www.technicalcommunicationcenter.com/wp-content/uploads/2013/04/MS-Word-New-Paragraph-Style-Out-of-Text-3.png)
First, open the Styles pane by clicking the arrow at the bottom right-hand corner of the Styles gallery, or pressing Ctrl + Alt + Shift + S. If the style you want to add is not in the Style Gallery at all, you can add it. It makes sense to have the styles you use most frequently in a prominent place in this panel, and Word allows you to both add styles to the gallery, and to rearrange the order of them once they’re there. Word’s Quick Styles G allery can be changed to show the styles you want not the collection decided by Microsoft.