Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Search VFP Path and Subfolders for DOC files.
Message
De
12/03/2002 20:27:46
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00630625
Message ID:
00631862
Vues:
19
>>>At the startup of my app, I establish the path in my Setup.prg file as follows:
>>>SET PATH TO &gcPath
>>>
>>>gcPath is assigned a value earlier of h:\labtemp;h:\upsi;h:\labnav
>>>
>>>How do I make the line:
>>>
>>>oDoc = oWord.Documents.Open(lcDocument)
>>>
>>>properly search a subfolder beneath the folder h:\labnav named \letters for the file pcbOil.doc.
>>
>>Combine file() and fullpath():
>>
>>
if file(lcDocument)
>>   lcDocument=fullpath(lcDocument)
>>else
>>   do what you do when file isn't there
>>endif
>>File() function will find your document anywhere along VFP path, and fullpath() will give its absolute path, which you can then submit to oWord.Documents.Open(lcDocument).
>
>Dragan,
>
>Thank you. That will work ok if I assign the value of "letters\pcbOil.doc" to lcDocument. Is there a command similar to File() that will search all subfolders on the VFP Search path?

You may try splitting your path into an array, using alines(), and then recursively searching each of the subdirectories with adir() until you get all directories under your path. You can do this once and add all these directories to the path (or save them somewhere as a list). IOW, there's a way, but you have to code the recursion yourself, there's no ready tool for that. There are some samples in downloads here, on how to recurse directories (either using adir() or Windows Scripting Host).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform