Find and bookmark text while Word is not visible 
Author Message
 Find and bookmark text while Word is not visible

Appreciate all the help I've gotten in automating Word.

Am still having one minor problem.  I'm searching for text in a Word
document, bookmarking it, and recording the bookmarks in an Access
database.  Unfortunately, I want this to function in the background of
my Access application and it just doesn't work unless I make the word
document visible.  Is there anyway around this?

If not, is there a way to give Access the focus, and have the Word
window take over the screen when it is doing the search and find
operation?

--
HTH

Dale Fye



Mon, 05 Dec 2005 23:49:35 GMT  
 Find and bookmark text while Word is not visible
Hi Dale,

Really hard to judge without seeing how your code is working. Are you
using the Selection object, or Range to work in the Word document? If
Selection, try changing things to Range and see if that helps.

Quote:
> Am still having one minor problem.  I'm searching for text in a Word
> document, bookmarking it, and recording the bookmarks in an Access
> database.  Unfortunately, I want this to function in the background of
> my Access application and it just doesn't work unless I make the word
> document visible.  Is there anyway around this?

> If not, is there a way to give Access the focus, and have the Word
> window take over the screen when it is doing the search and find
> operation?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 2003)
http://www.mvps.org/word

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



Thu, 08 Dec 2005 16:53:47 GMT  
 Find and bookmark text while Word is not visible
Cindy,

Thanks for your response.  Here is my text.  I'll try your suggestion,
but would appreciate your review of my code.

    With Selection.Find
        Do While .Execute(FindText:=Trim(SearchFor), _

MatchCase:=Forms!frm_Search_Bookmark_Multiple.chk_Case, _
                          MatchWholeWord:=True, _

MatchAllWordForms:=Forms!frm_Search_Bookmark_Multiple.chk_WordForms, _
                          Forward:=True, _
                          Wrap:=wdFindStop) = True

            On Error Resume Next
            'increment the word search counter
            lngCount = lngCount + 1
            'Debug.Print lngCount, .Found
            oWord.Documents(FileName).Bookmarks.Add Name:=SearchFor &
lngCount
            If Err.Number = 0 Then  'If no error occurred write the
search results to the database
                strSQL = "INSERT INTO tbl_SearchResults (SearchID,
FileName, BookmarkID) " _
                       & "SELECT " & Chr$(34) & SearchID & Chr$(34) &
", " _
                                   & Chr$(34) & FileName & Chr$(34) &
", " _
                                   & lngCount
                db.Execute strSQL
            Else
                Debug.Print Err.Number, Err.Description
            End If

            'If flag only first occurance checkbox is checked, exit
loop
            If Forms!frm_Search_Bookmark_Multiple.chk_FirstOnly Then
Exit Do

            'If Cancel was pressed, exit loop
            If Me.chk_Cancel Then Exit Do
            DoEvents
            Debug.Print lngCount
        Loop

    End With

--
HTH

Dale Fye



Hi Dale,

Really hard to judge without seeing how your code is working. Are you
using the Selection object, or Range to work in the Word document? If
Selection, try changing things to Range and see if that helps.

Quote:
> Am still having one minor problem.  I'm searching for text in a Word
> document, bookmarking it, and recording the bookmarks in an Access
> database.  Unfortunately, I want this to function in the background
of
> my Access application and it just doesn't work unless I make the
word
> document visible.  Is there anyway around this?

> If not, is there a way to give Access the focus, and have the Word
> window take over the screen when it is doing the search and find
> operation?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 2003)
http://www.mvps.org/word

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



Mon, 12 Dec 2005 22:48:49 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Set bookmarks with word not visible

2. WORD bookmark not printing VB text only on some PC's

3. WORD bookmark text not printing from VB only on certain PC's

4. not visible text box not updating database

5. "Word cannot find the requested bookmark"

6. Ensuring my found text is visible

7. Bookmark not found

8. Please help with text box to Word bookmark problem

9. Word 2K Add text to bookmarks using Input Box

10. Please help with text box to word bookmark

11. Usercontrol Text property not visible in property window

12. Usercontrol Text property not visible in property window

 

 
Powered by phpBB® Forum Software