Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recursive to search the Excel/Word's Doc and open it
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00300870
Message ID:
00301617
Vues:
34
>Geroge,
>
>Thank for your assistance. I have already add the AddBS function in the dir_tree function and this function has already worked. Now I have a problem to find out all the Excel's Worksheet of the entire harddisk, and then open the Excel's Worksheet. Is it possible to teach me how to enhance the dir_tree procedure to solve the problem (Find the Excel's Worksheet and then open it).
>
>Best Regards
>
Hi Dennis,

Below is a short procedure that demonstrates how to do what you want. Note that in the code below, the root directory isn't checked.
PROCEDURE Load_XL

LPARAMETER ta_files

EXTERNAL ARRAY ta_files
DIMENSION ta_files[1]
ta_files = ""
LOCAL loDirTree, a_dir, lcskel, lcdrive,;
  lni, lnlast, lcpath, a_files, lnj, lnfiles,;
  lnoffset
SET PROCEDURE TO DirTree ADDITIVE
* C:\ is the default start path
loDirTree = CREATEOBJECT('Dir_Tree')
RELEASE PROCEDURE DirTree
DIMENSION a_dir[1]
loDirTree.LoadTree(@a_dir)
lcdrive = "C:\"
lcskel = "*.XLS"
lnlast = ALEN(a_dir, 1)
FOR lni = 1 TO lnlast
  lcpath = lcdrive + ADDBS(a_dir[lni, 1])
  DIMENSION a_files[1]
  a_files = ""
  lnfiles = ADIR(a_files, lcpath + lcskel)
  IF lnfiles > 0
    IF EMPTY(ta_files[1])
      lnoffset = 0
    ELSE
      lnoffset = ALEN(ta_files, 1)
    ENDIF
    DIMENSION ta_files[lnoffset + lnfiles]
    FOR lnj = 1 TO lnfiles
      ta_files[lnoffset + lnj] = lcpath + a_files[lnj, 1]
    NEXT
  ENDIF
NEXT
loDirTree = NULL
RETURN
ENDPROC
hth,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform