+ Reply to Thread
Results 1 to 5 of 5

Debugging Array Error

  1. #1
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Debugging Array Error

    I want to write code that will check in a directory (C:\Test\) if a folder exists, and if the folder does not exist then create the folder. What I tried to this point was:
    Please Login or Register  to view this content.
    I get a debug error of type mismatch with the ode I have above. What I am trying to do is to cycle through each of the folders in M and create a directory in my target. But there has to be something wrong with my code.
    Last edited by jo15765; 12-12-2011 at 10:03 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Help with Coding

    Array is the name of a VBA function; if you name a variable that, then you can't use the function.

    Please take a few minutes to read the forum rules, and then amend your thread title accordingly.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Re: Help with Coding

    I didn't mean to put that Dim Array at the top of my coding. I am not using Array as a variable. The code:
    Please Login or Register  to view this content.
    Still throws a type mismatch debug error

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Assistance Debugging Array Error

    Then your array is named M, not Array.

    Please Login or Register  to view this content.
    The folder C:\Test must already exist.

  5. #5
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Re: Debugging Array Error

    Wow, I wasn't even in the same ballpark. Thank you for that! One followup, would it be possible to combine a save feature to that code? Meaning the same avsFolders that were just created, are folders that I need for quick recognition of data. So for example I have a module called Folder1 that does some refresh operations, copies some data etc etc, and then I would want my module Folder1 to save in the Folder1 I just created.

    As opposed to manually writing a save feature for each module, would it be possible to cycle through each of the avsFolders with code similar to this:
    Please Login or Register  to view this content.
    or to somehow reference the avsFolder when saving? so maybe something like:
    Please Login or Register  to view this content.
    Last edited by jo15765; 12-10-2011 at 03:21 AM. Reason: Forgot the code tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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