473,395 Members | 1,341 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,395 software developers and data experts.

Word 2000 Range.Find.Style fails after patch

Hi all,

I am trying to implement some Word-automation using the range.find-object
(using VB.net and Word 2000, early binding).

The sample underneath worked well, but after installing an 'after SP3 patch'
for Word ('upgrading' it to build 9.0.8216), it stopped working and now
generates the following error when I try to set the style-part of the
range.find object.

System.NullReferenceException: Object reference not set to an instance of an
object.
at Word.Find.set_Style(Object& prop)

The sample below follows various Microsoft documentation I can find, but
apparently someting has changed, and I can't find out what (though of course
I've already tried various things).

Who can help me?

Thanks in advance,
Arjen van der Hulst
== SAMPLE =================

Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oRng As Word.Range

Try
oWord = CType(CreateObject("Word.Application"), Word.Application)
oWord.Visible = True
oDoc = oWord.Documents.Add()
oRng = oDoc.Content

With oRng.Find

' Following line gives the error
.Style = Word.WdBuiltinStyle.wdStyleHeading1

.Text = "something"
.Execute()
If .Found Then
MsgBox("Found")
Else
MsgBox("Not Found")
End If
End With

oDoc.Close(False)
oDoc = Nothing
oWord.Quit()
oWord = Nothing

Catch ex As Exception
MsgBox("exception:" & " " & ex.ToString)
Finally
If Not oDoc Is Nothing Then oDoc = Nothing
If Not oWord Is Nothing Then oWord = Nothing
End Try

== END OF SAMPLE ===============

When replying directly to me, please remove "REMOVE_THIS." from my
emailaddress.

Nov 21 '05 #1
1 1951
Seemed that the fault was caused by an after office 2000 SP3 excel patch.
'Repairing' Word via the help-menu, option 'detect and repair' did the trick
to solve my problem.
Nov 21 '05 #2

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

Similar topics

8
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and...
5
by: John Smith | last post by:
Hey folks, I'm creating an MS Word document in a C# Windows application. Because the client base has so many different versions of Word they are using, I opted to go with late binding to create...
0
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...
5
by: STeve | last post by:
Hey guys, I currently have a 100 page word document filled with various "articles". These articles are delimited by the Style of the text (IE. Heading 1 for the various titles) These articles...
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...
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
1
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS....
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
1
by: =?ISO-8859-1?Q?S=F8ren?= | last post by:
Hi guys I got the following code: ------------------------------------------------------- Dim Word As New Microsoft.Office.Interop.Word.Application Dim Document As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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.