Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Multiple alignments in Header/Footer? Then replicating in VBA
I need to automate the insertion of headers and footers and link it to a
macro or toolbar button. (insert text, then change the font and font size) The header would include (left justified) the document name; and in the same line have (right justified) the page X of Y The footer would have 2 lines, starting with the path & filename then a custom string entered by the user in an input box. (both could be left justified, since they will be on separate lines). I know a long time ago (I might not have even been using Word at the time, to be honest) there were ways to have multiple justifications in headers/footers. Now I either have to insert a Format Paragraph/Tabs/Bar (which leaves an undesirable bar in the line) or mess with hovering over the text until the cursor changes to various alignments. Seems like there has to be a better way.... can anyone tell me how to insert my text and do everything via the keyboard so my macro recorder records it all? Thanks!! Keith -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. |
#2
|
|||
|
|||
Keith
The first point to note is that Header and Footer are styles. If you format the Header and Footer styles to use the correct font and have the correct tabs, inserting this information is dead simple. The second point is that as most of this information in the headers and footers is consistent, you should create a template for saving the styles and pre-entering the header and footer information. No need to resort to messy macros for this. Path, Filename, Page x of y are all fields that will update dynamically for each new document you create from the template. The string can be added by using the IncludeText field, so that too will be automated. Template is the way to go. For help on templates, see Creating Templates - The Basics parts 1 and 2 at http://word.mvps.org/Tutorials/index.htm -- Terry Farrell - Word MVP http://word.mvps.org/ "KR" wrote in message ... :I need to automate the insertion of headers and footers and link it to a : macro or toolbar button. (insert text, then change the font and font size) : : The header would include (left justified) the document name; and in the same : line have (right justified) the page X of Y : The footer would have 2 lines, starting with the path & filename then a : custom string entered by the user in an input box. (both could be left : justified, since they will be on separate lines). : : I know a long time ago (I might not have even been using Word at the time, : to be honest) there were ways to have multiple justifications in : headers/footers. Now I either have to insert a Format Paragraph/Tabs/Bar : (which leaves an undesirable bar in the line) or mess with hovering over the : text until the cursor changes to various alignments. : : Seems like there has to be a better way.... can anyone tell me how to insert : my text and do everything via the keyboard so my macro recorder records it : all? : : Thanks!! : Keith : : : -- : The enclosed questions or comments are entirely mine and don't represent the : thoughts, views, or policy of my employer. Any errors or omissions are my : own. : : |
#3
|
|||
|
|||
As Terry implies, the Header and Footer styles have built-in tab stops to
facilitate what you want to do (a centered tab stop in the center of the line, a right-aligned tab stop at the right margin). You can insert other tabs as needed, but the bar tab is not the type you want; see http://word.mvps.org/FAQs/Formatting/SettingTabs.htm. Once you have the information you need in a document, save it as a template (.dot file) for reuse--no macros required. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "KR" wrote in message ... I need to automate the insertion of headers and footers and link it to a macro or toolbar button. (insert text, then change the font and font size) The header would include (left justified) the document name; and in the same line have (right justified) the page X of Y The footer would have 2 lines, starting with the path & filename then a custom string entered by the user in an input box. (both could be left justified, since they will be on separate lines). I know a long time ago (I might not have even been using Word at the time, to be honest) there were ways to have multiple justifications in headers/footers. Now I either have to insert a Format Paragraph/Tabs/Bar (which leaves an undesirable bar in the line) or mess with hovering over the text until the cursor changes to various alignments. Seems like there has to be a better way.... can anyone tell me how to insert my text and do everything via the keyboard so my macro recorder records it all? Thanks!! Keith -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. |
#4
|
|||
|
|||
Thank you both, I will definitely take a look at styles and the MVP page.
The reason I was looking to macros is because our department doesn't do a good job of document control, and I wanted to be able to give everyone the ability to "click a button" and have the header and footer auto-populate with things like the path/filename, page numbers, date last updated, and other things- on documents that they just created, or things that they are opening from other sources... I was also going to link it to an inputbox (or small userform) because the only piece of information that can't be automated is the "expiration date" of the document. I thought that if I set it all up and made it an add-in on everyone's machines, that I'd have to use VBA to at least allow the inputbox, and possibly to deal with different documents, on different machines. The easier I make it for them to use, the more likely they will actually use it... "Suzanne S. Barnhill" wrote in message ... As Terry implies, the Header and Footer styles have built-in tab stops to facilitate what you want to do (a centered tab stop in the center of the line, a right-aligned tab stop at the right margin). You can insert other tabs as needed, but the bar tab is not the type you want; see http://word.mvps.org/FAQs/Formatting/SettingTabs.htm. Once you have the information you need in a document, save it as a template (.dot file) for reuse--no macros required. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "KR" wrote in message ... I need to automate the insertion of headers and footers and link it to a macro or toolbar button. (insert text, then change the font and font size) The header would include (left justified) the document name; and in the same line have (right justified) the page X of Y The footer would have 2 lines, starting with the path & filename then a custom string entered by the user in an input box. (both could be left justified, since they will be on separate lines). I know a long time ago (I might not have even been using Word at the time, to be honest) there were ways to have multiple justifications in headers/footers. Now I either have to insert a Format Paragraph/Tabs/Bar (which leaves an undesirable bar in the line) or mess with hovering over the text until the cursor changes to various alignments. Seems like there has to be a better way.... can anyone tell me how to insert my text and do everything via the keyboard so my macro recorder records it all? Thanks!! Keith -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why is the header/footer sometimes missing? | New Users | |||
Multiple styles in a single paragraph | Microsoft Word Help | |||
Multiple docs open multiple words | New Users | |||
Word Attachments open multiple copies of Word | Microsoft Word Help | |||
Multiple Alignments on the Same Line | Page Layout |