D
Diane
Group,
I have a VB.NET program that searches a directory for all *.docs, then
does a search & replace funtion. For each document that a search & replace
was made, I need a printed copy of the document with the "filename" included
in the footer of the printed doc. I have tried various code samples to get
the filename in the footer, but still have not been able to accomplish this.
This is the latest code I have use:
Dim section As Word.Section
Dim wordHeaderIndex As Word.WdHeaderFooterIndex =
Word.WdHeaderFooterIndex.wdHeaderFooterFirstPage
If printdoc = "Y" Then
section.Headers.Item(wordHeaderIndex).Range.Fields.Add(Microsoft.Office.Interop.Word.WdFieldType.wdFieldEmpty, "FILENAME", True)
oDoc.PrintOut()
End If
Above code will not compile
error---->
"Value of type 'Microsoft.office.interop.word.wdFieldType' cannot be
converted to "Microsoft.Office.Interop.Word.Range'.
Any examples of filename printing in a footer would be great!
Diane
I have a VB.NET program that searches a directory for all *.docs, then
does a search & replace funtion. For each document that a search & replace
was made, I need a printed copy of the document with the "filename" included
in the footer of the printed doc. I have tried various code samples to get
the filename in the footer, but still have not been able to accomplish this.
This is the latest code I have use:
Dim section As Word.Section
Dim wordHeaderIndex As Word.WdHeaderFooterIndex =
Word.WdHeaderFooterIndex.wdHeaderFooterFirstPage
If printdoc = "Y" Then
section.Headers.Item(wordHeaderIndex).Range.Fields.Add(Microsoft.Office.Interop.Word.WdFieldType.wdFieldEmpty, "FILENAME", True)
oDoc.PrintOut()
End If
Above code will not compile
error---->
"Value of type 'Microsoft.office.interop.word.wdFieldType' cannot be
converted to "Microsoft.Office.Interop.Word.Range'.
Any examples of filename printing in a footer would be great!
Diane