+ Reply to Thread
Results 1 to 2 of 2

Tranferring Text from Excel to a Header in Word

  1. #1
    Mike
    Guest

    Tranferring Text from Excel to a Header in Word

    Hi all,

    I have a macro that exports a range of data and chart from excel to a word
    template in the form of a jpeg.

    Is it possible to take text entered in particular cell in the excel template
    and copy it to a Ms Word Header ? e.g. say the name of someone..

    I have the code for opening word and pasting the other data but accessing
    the word header is where I fail !

    Any help is much appreciated.


    Michael

  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello Michael

    I hope this help you


    Sub insertData_In_WordHeader()
    'Activate Microsoft Word xx.x Object Library
    Dim WordApp As Word.Application
    Dim WordDoc As Word.document

    Set WordApp = New Word.Application
    WordApp.Visible = True

    Set WordDoc = WordApp.Documents.Open("C:\myDocument.doc")

    With WordDoc.Sections(1)
    .Headers(wdHeaderFooterPrimary).Range.Text = Range("A1")
    .Headers(wdHeaderFooterPrimary).Range.Paragraphs.Alignment = wdAlignParagraphCenter
    End With
    End Sub



    Regards ,
    michel
    Last edited by michelxld; 06-25-2005 at 12:10 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1