Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA and subdirectory structures (Office 2003)

    Hi, all. I'd like some general advice or guidance or expertise before I start my newest project.

    The main thing I need to do is create an entire subdirectory structure (i.e. a "tree") on a particular share, utilizing the code-name for the project. But I have a couple of concerns.

    For example, there's no certainty that everyone has the same drive letter mapped to the share. In light of this, what is the best approach to take? Should I dare try to map a drive in real-time? Should I just work with UNC names, even though it would prevent me from using methods that require drive letters, such as ChDrive? Since latency is a bit pronounced around here, would performance suffer even more if the default drive were different than the share I'm working with (I expect to be issuing a LOT of DIR() commands before creating the folder-structure)? If so, how do I make a file-share the default drive if there's no letter associated with it, and would this even speed up the performance of a series of DIR commands?

    It's such a (seemingly) simple task, yet all of these constraints are making my error-handling the most complex part!
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA and subdirectory structures (Office 2003)

    I'd use Scripting.FileSystemObject with its methods such as CreateFolder etc.
    You should be able to use UNC paths throughout, without needing ChDrive etc.

  3. #3
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA and subdirectory structures (Office 2003)

    Thanks, Hans, as always. I was wondering if I should just resort to the FileSystemObject, if for no other reason than it's so much more robust and flexible. With respect to the latency: frequently, connecting to a drive for the first time (i.e. clicking on it in Explorer) often takes a couple of seconds here. I was wondering if that time is minimized on subsequent queries (directory calls) because it's cached or because it becomes (in VB-speak) the "current drive". I will need to check for the existence of many folders (ostensibly using FolderExists), thus my concern about how to make a share the current drive.
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA and subdirectory structures (Office 2003)

    I don't know how the technical side of all this (caching accesses to shares etc.) works, sorry.

Posting Permissions

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