View Single Post
 
Old 10-14-2019, 05:20 AM
ksor ksor is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Feb 2018
Location: Århus V, Denmark
Posts: 74
ksor is on a distinguished road
Default Treversing directories and open WORD-docs ???

I'm treversing files in a folder and its sub-folders by using DIR in Access VBA.

I need to search 1000's of WORD-documents for a inserted link (one link at a time) - I have a function for that and that function needs the document to be OPEN - so I ran into see 3 problems here:

1) to open the document I need the PATH to the filename and the DIR only gives me the filename - is there a trick to let DIR give me the PATH too ?

2) It seems like DIR is NOT treversing into the SUB-folders - how can I force it to do that ?

3) I think I have to open WORD HIDDEN, then do the search and CLOSE WORD again - I know I have 1000's of WORD files and I fear it wil take a very long time to do that search - is there a better/faster method ?

To maybe find a better method I did some testing of 3) and found out in Windows - I just opened a folder with WORD-documents or in some subfolders in it and filled the search field with a text I KNOW is used in a link in some of the documents - very, very, very fast the search result came up !!!!!!!


I can get the "search text" in the field left to the search field and it look something like this:

search-ms:displayname=Søg%20efter%20resultater%20i%20Slæg tsforskning_V4&crumb=filnavn%3A~<spiseis.KMZ%20ELL ER%20System.Generic.String%3Aspiseis.KMZ&crumb=location:C%3A%5CUsers%5Cksor%5CDocuments%5C Slægtsforskning%5CSlægtsforskning_V4

and I can "re-search" (= do the search again) if I just insert the search sting in the "address line" and it's very, very fast !!!!!!!!!


There is a sort of solution as an addin to WORD, but I just want that plain and simple function returning false or true if the link is found or not - I like Occams Razor (very early KISS !) :
Document Batch Processes



How can I construct and use this same "search function/string" from within my Access VBA code to get a TRUE or FALSE if the link I search for (here spiseis.KMZ) is used or not ?

Last edited by ksor; 10-15-2019 at 04:20 AM. Reason: More infos
Reply With Quote