• Open without a drive letter (VBA for Word2003)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Open without a drive letter (VBA for Word2003)

    Author
    Topic
    #443189

    Windows XT sometimes looses the consecutiveness of the drive letters that it has assigned to mountable devices. If, for example, the drive letters available for mountable devices start with “I”, and VBA code needs to open a file stored on a flash memory drive, the drive letter “I” has to be specified in its Open (or ChDrive) statement. Now, if for some irrelevant reason, the letter “I” has been assigned to another device, Windows, upon detecting the mounting of the flash drive, will assign it the letter “J”. In this case the attempt to Open its file will fail. And, even after the two devices have been dismounted (using the proper procedures) and the PC rebooted, the flash device when mounted will still be assigned the letter “J”.

    The only way to get the existing code to work is to manually tell Windows to change the drive letter “J” back to “I” as can be done in the following three steps:
    1. Right-click on My Computer and select Manage, then Disk Management.
    2. In the Computer Management dialog box, right-click on the representation of the J: drive.
    3. In the resultant context menu, select Change Drive Letter or Paths, and then from the drop-down list select “I”.

    I know that rather tedious code can be written to scan all available drive letters looking for one that is assigned and that contains the required file, but even that will fail if a file of that name is held in more than one place. Therefore, three questions:

    1. Is there a way to issue a VBA Open statement without knowing the assigned drive letter, i.e. to tell Windows to find it?

    2. Is there a way, possibly via a call to an external API, to tell Windows to re-assign the drive letter?

    3. Is there a PDK (Program Developers Kit) available for Windows XT and/or Vista. I remember when coding for Windows 95 and earlier, an easily downloadable PDK was always on the Microsoft site filled with this type of information. If not, where can I find out this kind of stuff without bothering you?

    For those of you that will volunteer answers or comments, I thank you for your time and knowledge.

    John Littell

    Viewing 2 reply threads
    Author
    Replies
    Viewing 2 reply threads
    Reply To: Open without a drive letter (VBA for Word2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: