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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access VBA Locking Up Every time I try some sort of Find Command

Status
Not open for further replies.

BeckyMc

Technical User
Jun 19, 2001
51
US
This is sort of a continuation of

Word VBA deleting Soft Section Breaks and Soft End of Line Chars

but slightly different.

I'm trying to go to a specific section of a document and start looping through paragraphs to clean up paragraphs but every time I use a variation of the Find command in vba my Access database locks up.

The database exports an RTF file, Opens a copy of a "template", copies the RTF file over and does a "Saveas" which works just fine.

Then I try any kind of find command for any text string inside the content

including

or

With ActiveDocument.Content.Find
.Text = "dear"
.execute
End With

Access locks up tells me I "encountered an error" and closes my whole database

I created a new "template" to be sure it wasn't that, I tried a new blank database to be sure it wasn't that but I can NOT use any kind of vba find feature from Access to Word without locking up. I deleted old RTF files so Access was forced to create a new RTF before starting anything else

Not sure what's going on there!
 


Hi,

Where is the code that assigns your MS Word application obejct and other Word objects? You are in MS Access, so ActiveDocument probably does NOT refer to a valid object.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I was setting that earlier but maybe too soon.....Will have to check on that one!
 
I think I was using a create object on the word application while using get object on a file in subsequent lines. I removed getobject and did an object.documents.open instead and we'll see if that helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top