Using Find in a Word document from Access freezes Access 
Author Message
 Using Find in a Word document from Access freezes Access

From inside a Microsoft Access97 Module, I am attempting to search a
Microsoft Word document for certain text (# in the example below).  The code
below works fine on all computers I have except a laptop running Win 98.  I
have a reference to the Microsoft Word Object Library.

The code works fine on the laptop until the line ".ClearFormatting".  Then
Access stops responding.  I can move around the document with other code and
do different things, but anytime I try to use Find, Access stops responding.

Any ideas?

---------

Sub Find_test()

'have Microsoft Word running for this test

Dim tempDoc As Word.Document
Set tempDoc = Word.Documents.Open("C:\windows\temp\test.doc")
MsgBox (tempDoc.Name & " has " & tempDoc.Words.Count & " words")
'above line just to see if we can do something with the document

'move to beginning of document
Word.ActiveDocument.Paragraphs(1).Range.Select
Word.Selection.Collapse Direction:=wdCollapseStart

    With tempDoc.ActiveWindow.Selection.Find
       .ClearFormatting
        .Text = "#"
        .Execute Forward:=True

    End With

    If tempDoc.Content.Find.Found = False Then
        MsgBox ("did not find #")
        Exit Sub
        Else
        MsgBox ("found #")
        End If

Word.ActiveDocument.Close

End Sub



Sun, 06 Apr 2003 11:07:39 GMT  
 Using Find in a Word document from Access freezes Access

Hi William,

Have you tried a complete uninstall/reinstall of Office (as per the KB article
for the release on the laptop - see Help/About)? That's the first thing I'd
try. If that has no effect, then boot up Windows in Safe Mode and see if it
still happens; if not, then there's probably a (video?) driver conflict.

Quote:
> The code
> below works fine on all computers I have except a laptop running Win 98.  I
> have a reference to the Microsoft Word Object Library.

> The code works fine on the laptop until the line ".ClearFormatting".  Then
> Access stops responding.  I can move around the document with other code and
> do different things, but anytime I try to use Find, Access stops responding.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



Fri, 11 Apr 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. accessing word document through vb.net using word com object

2. Access-Error printing Word Document from Access

3. Creating Embedded word documents from within Access using VBA

4. Closing a word documents using access?

5. Using Access Database - need to put a word document in

6. Closing a word documents using access?

7. Accessing XML document from a Word document

8. Generating word document files from embedded documents in Access or SQL Server DB.

9. opening Multiple documents cause the word to freeze

10. Find and Replace in Word Document using VBA

11. Find multiple words Using MS Word Find

12. move between Access and Word, back to Access, Close word

 

 
Powered by phpBB® Forum Software