using Access VBA to Find formated strings i Word document crash

B

BAnders

Hi,

I use Access VBA to read a Word document paragraph by paragraph. Some of
those paragraphs are imported to Access table. Sometimes certain keywords in
Bold is the trigger to import. The code looks like the following:

dim rng as Word.Range

set rng = wds.activedocument.paragraphs(x).range

with rng.find

..clearformatting
..fomat=true
..font.bold=true
..text ="String to find" ' in bold
..execute
if .found then ...

end with

Access crash with the following message:

Microsoft Access for Windows has encountered a problem and needs to close.

AppName: msaccess.exe AppVer: 9.0.0.6620 ModName: oleaut32.dll
ModVer: 5.1.2600.2180 Offset: 0007c09e

After that I have tried to:

Replace all statements with the object variable directly = removed the with
statement
Set brackets "[ ]" around methods etc.
Removed forms that are not in use - the application is a bit large - 60 MB
and mainly code. Nearly all data is linked. Just program control data in
mdb.

Still, it aborts but now in the kernel.dll.

So far, I haven't seen any error report about access/word crashing each
other.

What is wrong - has anyone any idea? Anyway, it seems hard to get Find
object in word to work!

I am using Win XPpro and Office 2000 Premium

Thanks in advance!

BAnders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top