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.Application
WordApplication = DirectCase(CreateObject("Word.Application"),
Word.Application)
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.ClearFormatting and trying to watch
' ** the object also causes Debugger to quit - at this point
Word.Application seems to be null...
Search.ClearFormatting()
Search.Text = SubstanceName & "=" & Substance & ControlChars.Cr &
TreatmentName & "=" & Treatment & ControlChars.Cr & SubjectName & "=" &
Subject
Search.Replacement.Text = ""
Search.Forward = True
Search.Wrap = Word.WdFindWrap.wdFindContinue
Search.Format = False
Search.MatchCase = True
Search.MatchWholeWord = False
Search.MatchWildcards = False
Search.MatchSoundsLike = False
Search.MatchAllWordForms = False
Search.Execute()
Many thanks for your help,
Kind Regards,
Andrew 2 3650
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.Application WordApplication = DirectCase(CreateObject("Word.Application"), Word.Application) 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.ClearFormatting and trying to watch ' ** the object also causes Debugger to quit - at this point Word.Application seems to be null...
Search.ClearFormatting() Search.Text = SubstanceName & "=" & Substance & ControlChars.Cr & TreatmentName & "=" & Treatment & ControlChars.Cr & SubjectName & "=" & Subject Search.Replacement.Text = "" Search.Forward = True Search.Wrap = Word.WdFindWrap.wdFindContinue Search.Format = False Search.MatchCase = True Search.MatchWholeWord = False Search.MatchWildcards = False Search.MatchSoundsLike = False Search.MatchAllWordForms = False Search.Execute()
Many thanks for your help,
Kind Regards,
Andrew
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\SYSTEM32\URTTemp\Regtlib.exe" "C:\Program Files\Microsoft
Office\Office\msword9.olb"
Echo.
Echo.Registration Complete
Echo.
@Pause
--
Sent via .NET Newsgroups http://www.dotnetnewsgroups.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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.
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |