473,605 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Word 2000 / VB.Net Automation Help Required

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 interact with
Word 2000 SP-3 to find and replace text within a word document.
Unfortunately, development (not created by me!) occured with Word 2000 SR-1
and on ugrading the references and version to SP-3, some of the code
inexplicably stopped working, I am hoping somebody might be able to help me
here with suggestions of why the failure is occuring.

Debugging had become difficult too - if I try to debug the application,
Visual Studio debugger quits when executing the call to set my Word.Find
object to the value of WordApplication .Selection.Find - this is very
strange, and again any support to solve this would be really appreciated.

The code - previously this worked with SR-1, but with SP-3 now fails:

Private WordApplication As Word.Applicatio n
WordApplication = DirectCase(Crea teObject("Word. Application"),
Word.Applicatio n)
WordDocument = WordApplication .Documents.Open ("MyDocFile.Doc ")
Dim Search As Word.Find = WordApplication .Selection.Find

' ** FAILURE occurs here... when ClearFormatting called an ActiveX Object
not found error occurs.
' ** Debugger quits if you try to run next line and breaking on
Search.ClearFor matting and trying to watch
' ** the object also causes Debugger to quit - at this point
Word.Applicatio n seems to be null...

Search.ClearFor matting()
Search.Text = SubstanceName & "=" & Substance & ControlChars.Cr &
TreatmentName & "=" & Treatment & ControlChars.Cr & SubjectName & "=" &
Subject
Search.Replacem ent.Text = ""
Search.Forward = True
Search.Wrap = Word.WdFindWrap .wdFindContinue
Search.Format = False
Search.MatchCas e = True
Search.MatchWho leWord = False
Search.MatchWil dcards = False
Search.MatchSou ndsLike = False
Search.MatchAll WordForms = False
Search.Execute( )

Many thanks for your help,

Kind Regards,

Andrew

Nov 21 '05 #1
2 3673
Have you solved this problem? If so, I'd be interested in your
solution.

Thanks!

Andrew Cranwell wrote:
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 interact with
Word 2000 SP-3 to find and replace text within a word document.
Unfortunately, development (not created by me!) occured with Word 2000 SR-1
and on ugrading the references and version to SP-3, some of the code
inexplicably stopped working, I am hoping somebody might be able to help me
here with suggestions of why the failure is occuring.

Debugging had become difficult too - if I try to debug the application,
Visual Studio debugger quits when executing the call to set my Word.Find
object to the value of WordApplication .Selection.Find - this is very
strange, and again any support to solve this would be really appreciated.

The code - previously this worked with SR-1, but with SP-3 now fails:

Private WordApplication As Word.Applicatio n
WordApplication = DirectCase(Crea teObject("Word. Application"),
Word.Applicatio n)
WordDocument = WordApplication .Documents.Open ("MyDocFile.Doc ")
Dim Search As Word.Find = WordApplication .Selection.Find

' ** FAILURE occurs here... when ClearFormatting called an ActiveX Object
not found error occurs.
' ** Debugger quits if you try to run next line and breaking on
Search.ClearFor matting and trying to watch
' ** the object also causes Debugger to quit - at this point
Word.Applicatio n seems to be null...

Search.ClearFor matting()
Search.Text = SubstanceName & "=" & Substance & ControlChars.Cr &
TreatmentName & "=" & Treatment & ControlChars.Cr & SubjectName & "=" &
Subject
Search.Replacem ent.Text = ""
Search.Forward = True
Search.Wrap = Word.WdFindWrap .wdFindContinue
Search.Format = False
Search.MatchCas e = True
Search.MatchWho leWord = False
Search.MatchWil dcards = False
Search.MatchSou ndsLike = False
Search.MatchAll WordForms = False
Search.Execute( )

Many thanks for your help,

Kind Regards,

Andrew


Nov 21 '05 #2
Molly,

There is a Microsoft solution to this, you have to re-register the word
type library.

Use this batch file.

Echo.Automation Client Fix v1.00
Echo.
Echo.This fix re-registers the Word library files due to corruption from
service pack and other updates.
Echo.This is a known Microsoft bug with Office and occurs due to the
re-use of unique Interface ID's (GUID).
Echo.
Echo.Microsoft Reference: Q292744 -
http://support.microsoft.com/?id=292744
Echo.
"C:\WINNT\SYSTE M32\URTTemp\Reg tlib.exe" "C:\Program Files\Microsoft
Office\Office\m sword9.olb"
Echo.
Echo.Registrati on Complete
Echo.
@Pause

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3848
by: Jason Steeves | last post by:
I am hoping someone can tell me how, or point me in the right direction for the following problem. I need to have word open a specified file, .mht, as a plug-in inside of IE so that I can edit this file within the word plugin within IE. I am not even sure how I can get this to work with a .doc file. I appreciate any help you can give......Thanks, Jason
12
5515
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 and office XP components installed. ie I have word/access/excel 2k/xp/2003 installed. I tried to do a usual access 2k to word 2k automation yet I get the error "Automation Error" "ClassFactory cannot supply requested class" when on late binding try...
1
2142
by: moelleni | last post by:
Hi, I made an Access 2002 Database and wanted to automate it to sent the current record to Word 2002. So readed the article "How to send the current record to Word 2000 with automation" I tried to do this with my db. Here is my code: Private Sub MergeButton_Click() On Error GoTo MergeButton_Err
2
6636
by: Mystery Man | last post by:
We are developing a C# application that has many interfaces to the Microsoft suite (eg Word, Excel, Outlook, Powerpoint, etc). We need to support Office 97, 2000, 2002 and any future versions. Our first cut used early binding and worked fine with Office 2002. We then ran on a machine that had Office 2000 installed and it all turned to custard. There appears to be a number of options to take to support multiple versions:
2
2609
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 don't know why it crash some time.
0
6294
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather reformating, after the merge. This is a full description of my needs. I have a C# class library that creates two Crystal Reports, and then exports them to the harddrive as Word documents. One's orientation is landscape, the other is portrait. I then...
1
1262
by: Jack Jiao | last post by:
Hi, I am using MS Word inside C# application. The application is using impersonation as Administrator. The application works fine for a few days then suddenly I started to get "access is denied" message everytime I instantiate instantiate MS word like "oWordApp = new Word.ApplicationClass();" Not just this application, any application uses word automation now don't work any more. There's nothing I can do to make the error go away. ...
4
3690
by: JensB | last post by:
I have VB.Net VS2005 App which creates MS Word documents. Clients are using Word 2000 and Word2003. Project refers to MS Word 9.0 Object library, declaring Word as an object. On the Word 2000 machines this works fast and nice, but on the Word 2003 machines it takes 5-10 times longer. Is there a way to make Word 2003 clients to work faster? Recently a warning message, showed up in the error list: "There are updated custom wrappers...
1
1292
by: ljh | last post by:
I want to develop an application that can watch for and monitor any instance of Word 2000/2003. I need to be able to write an add-in menu for Word 2000/2003 and capture all keystrokes and mouse events done in Word also, for a training application. I am searching for all of the code that I can get my grubby little hands on that shows key and mouse capturing with .Net 2005 and code that shows monitoring and controll of Word, Outlook and...
0
8001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8424
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8286
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1537
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.