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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Useful Word Automation examples.

Word Automation

Useful Word Automation examples.

by  Mike Gagnon  Posted    (Edited  )
[ol][li]How to add a picture to the footer of a word document
Code:
#DEFINE wdSeekPrimaryFooter 4
LOCAL oWord,loDoc
oWord = CREATEOBJECT('word.application')
loDoc = oWord.documents.add()
oWord.ActiveWindow.ActivePane.View.SeekView= wdSeekPrimaryFooter
WITH oWord.selection
   .InlineShapes.AddPicture("C:\Documents and Settings\MIKE_G\My Documents\My Pictures\spongebob.jpg")
ENDWITH
[/li]
[li]How to determine and navigate between pages of a multiple page Word document.
Code:
oWord = createobject('word.application')
odocument=oWord.Documents.Open('c:\all products') && Multiple page document.
oDocument.Repaginate  && Just to make sure the page count is right.
DO WHILE oWord.selection.Information(3)<> oWord.Selection.Information(4)
       MESSAGEBOX( "The selection is on page " +TRANSFORM(oWord.selection.Information(3)) + " of page "+;
        TRANSFORM(oWord.Selection.Information(4)))
    oWord.Browser.Next && Skip a Page 
ENDDO
[/LI][/ol]



Mike Gagnon
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top