473,396 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 5099
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.