By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,849 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,849 IT Pros & Developers. It's quick & easy.

word automation find and replace

P: n/a
Using vb asp.net 1.1

I'm doing a word automation on a doc file and trying to do a find and
replace. My existing code works fine except that it doesn't find and
replace in the header.

My code to set the selection is as follows:

'This sets the selection to be the whole document

wordApp.Selection.HomeKey(Word.WdUnits.wdStory, Word.WdMovementType.wdMove)

' Select from the insertion point to the end of the document.

wordApp.Selection.EndKey(Word.WdUnits.wdStory, Word.WdMovementType.wdExtend)
I then loop through and do a find and replace using
wordApp.Selection.Find.Execute

My problem is, it doesn't Find and Replace in the header and footer. Any
idea on the syntax to automate find and replace there?

Thanks,

James
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi James

Nice to know someone else is automating word with asp.net!

I haven't done header/footer myself but there should be something in the
following search results page that will help ya...

http://www.pillage.com/search/Word_V...nd_Footer.html

Cheers
Dan

"James Vitale" wrote:
Using vb asp.net 1.1

I'm doing a word automation on a doc file and trying to do a find and
replace. My existing code works fine except that it doesn't find and
replace in the header.

My code to set the selection is as follows:

'This sets the selection to be the whole document

wordApp.Selection.HomeKey(Word.WdUnits.wdStory, Word.WdMovementType.wdMove)

' Select from the insertion point to the end of the document.

wordApp.Selection.EndKey(Word.WdUnits.wdStory, Word.WdMovementType.wdExtend)
I then loop through and do a find and replace using
wordApp.Selection.Find.Execute

My problem is, it doesn't Find and Replace in the header and footer. Any
idea on the syntax to automate find and replace there?

Thanks,

James

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.