Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sudden Word Automation Problem (.find.font)

Status
Not open for further replies.

ormsk

Programmer
Sep 30, 2002
147
GB
I am using VB6 to automate Word (2000).

Basically, the app opens up a WORD.doc and searches to see if a certain colour exists.

This had been working fine for a while, but now returns Object variable or With block variable not set (Error 91).

However, I have not amended the code anywhere regarding this and I have checked that my references are valid.

The line of code it is erroring out on is:
Code:
objWord.Selection.Find.Font.Color = SearchColour

SearchColour is a valid long value.
When I look at the Watch Window, objWord.Selection.Find returns appears to be a valid reference (even though the value is blank).

objWord.Selection.Find.Font returns Nothing.

Fortunately, I had been testing this on 2 separate machines and get the same problem on both machines now.

Even with previous backups (going back several revisions) do not work when they did at the time.

I cannot find a commonality to the same problem occurring on 2 separate machines. They had separate code and their own documents.

After a couple of attempts at trying to use the Watch Window, Windows will shut down VB



**********************************
There is more than one way to skin a cat...but who wants a skinned cat?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top