Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Setting up headers & footers in Word from Excel

Hi, i am trying to control Word from a Excel macro so that i can
create a document from infomation on the spreadsheet. My problem is i
am having problems setting up the headers and footers. Please can you
advise me on the following code,

Thanks Oggy




' Send commands to Word
Dim wrdApp As Word.Application
Dim doc As Word.Document
Dim rngDoc As Word.Range


Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set doc = wrdApp.Documents.Add ' create a new document

Set rngDoc = doc.Content

Dim HdFt As HeaderFooter
Set HdFt = doc.Sections(1).Headers(wdHeaderFooterFirstPage)



With WordApp

With HdFt
.Text = "Left side" & vbTab & "Center" & vbTab & "right side"
End With



With rngDoc
.Font.Name = "Times New Roman"
.Font.Size = 10
.Font.Bold = False
.Font.Italic = False
.ParagraphFormat.Alignment = 1
.Text = "QUOTATION" & vbCr
End With





End With

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up Default Headers/Footers in Excel Dragon Lady Excel Discussion (Misc queries) 3 September 1st 09 07:57 PM
Importing Excel report into Word showing headers and footers LossManiac Excel Discussion (Misc queries) 1 August 29th 08 01:56 PM
Setting the Headers and Footers in Excel 2007 when exporting Information from Cobol program Matt[_46_] Excel Programming 0 April 11th 07 07:29 PM
Export Entire Excel Sheet with headers, footers, etc, to Word Stacey Hartley Excel Programming 1 September 23rd 04 06:38 PM
Excel Headers & Footers Frank Kabel Excel Programming 0 August 24th 04 10:30 PM


All times are GMT +1. The time now is 02:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"