Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add information to a specific line in word

Status
Not open for further replies.

JasonEnsor

Programmer
Sep 14, 2010
193
GB
I have written the following macro in word2003 to add "TURN OVER" to the last but 1 line on a document and then add the page number on the last line, however i will have to run the macro everytime i want to add this data. is it possible to automatically add this information on the last 2 lines of a page whenever a new page is created? i know i could use footers however i am restricted from using them due to company policy....

Code:
Sub EndofPage()
    Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
    Selection.Font.Name = "Arial"
    Selection.Font.Size = 14
    Selection.TypeText Text:="TURN OVER"
    Selection.TypeParagraph
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.Font.Bold = wdToggle
    NormalTemplate.AutoTextEntries("Page X of Y").Insert Where:=Selection. _
        Range, RichText:=True
End Sub

Thank you in advance

Jason
 


'TURN OVER'

Apple or cherry?

New leaf?

In the grave?

Your guns?

and rub your tummy?

Reminds me of a spoof of trying to explain to a computer illiterate, opening a file, paging thru it and closing it. It is two monks, one explaining to the other the 'new' technology of a BOOK, having only known scrolls. The noob, just cannot get the hang of opening a book, turning a page and then closing the book. It was SOOOOO different, and SOOOOO much harder than handling the scroll!

You got to be kidding, right?



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Its for a question paper template, company policy says we have to tell them to turn over the page....
 
So what's the policy objection to using footers? They exist, after all, for exactly this sort of thing.

As for:
is it possible to automatically add this information on the last 2 lines of a page whenever a new page is created?
the answer is no.

Besides, there's no guarantee that whatever constitutes the last two lines at the time your macro runs will still be the last two lines when the document is opened on a PC using any other printer (or even the same printer with different settings) - let alone if, shock, horror, someone edits the document.


Cheers
[MS MVP - Word]
 
I don't know why they object to using the header and footer as afterall that is what they are there for. I have managed to create several macro's and a new toolbar with just the stlyes required on so i hope that is good enough otherwise i am throwing the towel in. if people listend to instructions i wouldnt need to do this.

Thanks to all of you for your suggestions and help
 
if people listend to instructions i wouldnt need to do this. "

and we would all be RICH! Or...out of a job.


unknown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top