+ Reply to Thread
Results 1 to 4 of 4

VBA7 compatibility question - Get UNC drive name

  1. #1
    Registered User
    Join Date
    02-10-2011
    Location
    Canada
    MS-Off Ver
    Excel 2019 / MS365
    Posts
    55

    VBA7 compatibility question - Get UNC drive name

    I am using code which I found from a reputable online source, which has worked perfectly until one of our users installed Office 2016 - 64 bit. The issue seems to be the 64 bit version of Office. I have learned that the code can be modified by using 'PtrSafe' & 'LongPtr'. I am comfortable with adding the 'PtrSafe' but I do not know which or how many of the original 'Long' statements must be changed.

    I have included all the code from this module, in case it is of help, but I suspect that the changes will only need to be made in the code preceeding the 'Function fnUNCPath(strDriveLetter As String) As String' line. I may be wrong with this assumption, so that is why I included all the code.

    Thank you in advance for your assistance.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,972

    Re: VBA7 compatibility question - Get UNC drive name

    Actually, you shouldn't change GetDriveType Lib... () As Long to LongPtr. As this value is not a pointer and is passed to fDriveType as Long (Dim lngRet As Long).

    Try below. Worked on my 64 bit environment.
    Please Login or Register  to view this content.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,972

    Re: VBA7 compatibility question - Get UNC drive name

    FYI - You can create function like below to avoid 32 bit/64 bit issue.
    Please Login or Register  to view this content.
    Last edited by CK76; 03-15-2019 at 10:48 AM. Reason: Added LEFT(,1) &":" part

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,972

    Re: VBA7 compatibility question - Get UNC drive name

    Oh, to get UNC name...
    Please Login or Register  to view this content.
    Use it like...
    Please Login or Register  to view this content.

+ 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] GetLongPathName - VBA7 / 64 bit version?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2015, 08:26 PM
  2. [SOLVED] Need to bypass the drive letter (i.e C Drive) and use the drive name
    By AndyMan81 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-17-2013, 04:48 PM
  3. Replies: 0
    Last Post: 07-12-2011, 11:30 AM
  4. [SOLVED] Can I save to hard drive AND my flash drive at the same time?
    By Gizelle in forum Excel General
    Replies: 3
    Last Post: 07-24-2006, 03:30 PM
  5. [SOLVED] A question on VBA compatibility between versions of Excel.
    By John Thomas in forum Excel General
    Replies: 7
    Last Post: 02-10-2006, 09:10 PM
  6. [SOLVED] Question about XML compatibility in Excel 2000/XP
    By aeg42 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2005, 05:06 PM
  7. [SOLVED] Default Drive Question
    By Mel in forum Excel General
    Replies: 2
    Last Post: 03-11-2005, 12:06 PM

Tags for this Thread

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