Results 1 to 5 of 5

Thread: [Excel] Application.filesearch - not working for Excel 2003?!?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    53

    [Excel] Application.filesearch - not working for Excel 2003?!?

    When I run "With Application.filesearch" (eg Copying some standard code off a vba website into a sheet a module and running it!), EVERY TIME it gets to

    Code:
    If .Execute > 0 Then
    ' my code
    End If
    It always comes up with a value of zero - ie it skips the code and goes to the end if.
    This applies to xls and doc file extensions, I have tried changing the sort properties, I have tried changing the SearchSubFolders property to true... everything.

    I even downloaded the "standard" Excel example sheet from the VBA Express site and ran that on a folder that is full of files - and still it returns NO FILES. I tdoesn't return an error, it just doesn't recognise there to be any files in the folder (even with msoFileTypeAllFiles!)

    I am using Ms Office 2003, in Excel, and the computer runs (fairly) normally for a PC on Windows.

    Does anyone have any idea what is going on?!?

    Thank you!

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [Excel] Application.filesearch - not working for Excel 2003?!?

    works fine for me in excel 2000
    post the entire procedure
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    53

    Re: [Excel] Application.filesearch - not working for Excel 2003?!?

    This is an excellent example: http://www.vbaexpress.com/kb/getarticle.php?kb_id=800

    Neither the procedure copied into a module, nor the download work. Any ideas?

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [Excel] Application.filesearch - not working for Excel 2003?!?

    i pasted the code into a module and ran, works fine for me except that application.filedialog is not available in excel 2000, so i had to modify (remove) that part

    i do not know why it might not work on your machine, you must put .xls or whatever file type you want to find in inputbox
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: [Excel] Application.filesearch - not working for Excel 2003?!?

    Ellie, can you show the exact code that you are using? Perhaps an sample Excel File would help in providing a faster resolution.

    Sid
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width