472,780 Members | 1,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 software developers and data experts.

word automation find and replace

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
1 5064
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David Krmpotic | last post by:
hi!! I would like to open an existing Word document and make few Replace actions.. for example I want to replace every occasion of word 'day' with word 'night'.. I know about automation and I...
12
by: Cheval | last post by:
Has anyone had any problems with inter-office automation between MS Word and MS Access in Office 2003? I have recently installed office 2003 in a new folder and have left the older office 2000...
0
by: David Krmpotic | last post by:
Regards, I need a little explanation in converting word VB macros to charp code! first, I recorded simple macro which replaces every occurence of one word in whole document (is it?) , here:...
2
by: kids | last post by:
Does anybody know any reason which could cause Ms. word automation to crash? I try to call word automation to open a document and use find and replace function. For some reason it works but I...
4
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
2
by: Andrew Cranwell | last post by:
Hi, Please redirect me if I am in the wrong group for this question... this is my first post to this group, so I hope it is clear! I am working on an automation project in VB.NET and have to...
1
by: Jordan | last post by:
Hi. I am autoamtiacally creating a MS Word file through code. Most of my code works, but when I try to do a find and replace, I get a read/write memrory access error. Not sure what is going on. Any...
22
by: liya.tansky | last post by:
Hello, I'm developing an intranet (win XP, .NET 2, Visual Studio 2005, Microsoft.Office.Interop.Word.dll in references) and needed to implement find-replace in word doc before sending letter and...
0
by: Rangeshram | last post by:
Dear All, Using C# and word object model, i am automate the process, where based on the tag name present in the document its corresponding style has to be applied for the paragraph. For...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.