+ Reply to Thread
Results 1 to 10 of 10

excel vba case sensitivity in a recursive function problem

  1. #1
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    excel vba case sensitivity in a recursive function problem

    I'm using some code example by Albert Kallall and Browne that uses a recursive function to build a collection of files based on a string search where strFileSpec is set to a wildcard file. srtTemp is the temporary directory being added to the collection if strFileSpec is True. As it is, strFileSpec is case sensitive at the code level, but the files vary in case sensitivity - some are all upper, some all lower, and even some are Proper. Is there a way to set an argument to find a search strFileSpec, regardless of case at the code level?
    Please Login or Register  to view this content.
    Last edited by terriertrip; 10-17-2020 at 01:02 AM. Reason: syntax

  2. #2
    Forum Contributor
    Join Date
    05-10-2012
    Location
    Paris, France
    MS-Off Ver
    2016/365
    Posts
    123

    Re: excel vba case sensitivity in a recursive function problem

    Hi terriertrip

    Can we have the global code or the file that contains it?
    If you are satisfied with my answer, please add reputation

  3. #3
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: excel vba case sensitivity in a recursive function problem

    I've attached a sample file with code explanation.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    05-10-2012
    Location
    Paris, France
    MS-Off Ver
    2016/365
    Posts
    123

    Lightbulb Re: excel vba case sensitivity in a recursive function problem

    Hi terriertrip,

    For me the problem is not in the recursive function of the path, but in GetFiles procedure

    Test
    Please Login or Register  to view this content.
    The line below
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: excel vba case sensitivity in a recursive function problem

    Its very odd. I have a whole subdirectory called 'dq' that vFile isn't not looping through. I debugged the For Next statement and it shows that the directory is completely skipped within colFiles. Spaces aren't the issue since there are other folders and files with spaces that colFiles successfully collects.

    All the files within the problematic directory are uppercase, but it wouldn't make a difference since Search isn't case sensitive. This is evident after debugging, since the function is properly collecting all subdirectories with the criteria of 'dq' regardless of case; all with the exception of the missing directory, hence leaving no files to Search since they have not been added to the collection.

    The wildcard formatting doesn't seem to be a problem either, since there are folders both 'dq' and 'DQ' that are added to the collection. I've even tried changing the name of the subdirectory. In addition, the subdirectory before and after are being added to the collection. Its as if the subdirectory might as well not exist. I'm stumped.
    Last edited by terriertrip; 10-20-2020 at 11:24 PM.

  6. #6
    Forum Contributor
    Join Date
    05-10-2012
    Location
    Paris, France
    MS-Off Ver
    2016/365
    Posts
    123

    Re: excel vba case sensitivity in a recursive function problem

    Hi

    Where is the folder called 'dq' ?
    Not in this screen capture

  7. #7
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: excel vba case sensitivity in a recursive function problem

    Apologies for the confusion. The folder 'dq files' was originally called 'dq'. I ran the routine with both file name versions. Either way, that folder is being skipped. Everything in Permian and San Juan folders is being searched.

  8. #8
    Forum Contributor
    Join Date
    05-10-2012
    Location
    Paris, France
    MS-Off Ver
    2016/365
    Posts
    123

    Question Re: excel vba case sensitivity in a recursive function problem

    Hi,

    So sorry for you, but at home the search works perfectly with the "dq files" folder

    What criteria do you enter in the 2 dialog boxes ?

    Is folder ownership not over hidden ?

  9. #9
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: excel vba case sensitivity in a recursive function problem

    Yes very frustrating for me since it makes no sense. There is no difference in ownership or hidden files/folders.
    The criteria I input into the dialog boxes are: 1) dq 2) Benzene
    Below are all the files not being collected. The image on the right are the files within 'raw text data'
    Last edited by terriertrip; 10-20-2020 at 11:24 PM.

  10. #10
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: excel vba case sensitivity in a recursive function problem

    I ran another test and used 'DQ' instead of 'dq' in the folder criteria for strFileSpec and it worked!!! It looped through all directories that had the string 'dq' and 'DQ' and listed all files that were named 'dq' and 'DQ'. I sure would like to know why it worked for uppercase but not lowercase.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Case sensitivity with IF statement
    By AceForSale in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-18-2018, 10:31 AM
  2. SQL LIKE case sensitivity issue
    By keyston in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2011, 09:16 AM
  3. write name checking function where case sensitivity does not matter
    By netdude_18 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-23-2008, 01:39 PM
  4. multiple if's and case sensitivity
    By xcelnoob in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-22-2007, 09:54 PM
  5. Using EXACT function without case-sensitivity?
    By Kayote in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-23-2007, 09:53 AM
  6. [SOLVED] VLookup & Case Sensitivity
    By KHogwood-Thompson in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-11-2006, 04:35 AM
  7. Case Sensitivity problem with data validation
    By Upya in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2005, 09:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1