+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    03-02-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    1

    Opening Word doc from Excel VB - and adding page numbers

    I have managed to create code to create a new word doc, open the doc and insert text into the word doc header and footer; But I can't find a way to get a 'Page x of y' into the footer; The code that is generated by recording a macro in word to do this fails when that code is placed inside the excel code. Any ideas??

    Both;

    Code:
    wdApp.NormalTemplate.AutoTextEntries("Page X of Y").Insert Where:=Selection.Range, RichText:=True
    and

    Code:
        wdApp.Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
        wdApp.Selection.TypeText Text:=" of "
        wdApp.Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
    Both these seem to fail when the code is in Excel rather than in word?? Help??
    Last edited by Leith Ross; 03-02-2009 at 11:21 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0