View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sheldon Sheldon is offline
external usenet poster
 
Posts: 51
Default Creating a Word Document from Excel Data

I have managed to create a work document containing all the formulas in a
selected worksheet. However, when I try in Excel VBA to add a footer to the
word document only part of the footer is created. The code I am using, which
I got from running a macro in Word is

.Selection.TypeText Text:="Page "
.Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
.Selection.TypeText Text:=" of "
.Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter

The code lines that start with ".Selection.Fields.Add Range:" does NOT
work.

Any suggestions???

Thanks