+ Reply to Thread
Results 1 to 2 of 2

UNC Paths

  1. #1
    Paul Smith
    Guest

    UNC Paths

    Is it possible to use a UNC path with ChDir?

    I want to replace:

    ChDir "G:\Shared\Access\Project Area\Project 1"

    with

    ChDir "\\[Server Name]\]Share]\Project Area\Project 1"

    This does now seem to work for me...should it?



  2. #2
    Rob Bovey
    Guest

    Re: UNC Paths

    "Paul Smith" <pws@twelve.me.uk> wrote in message
    news:4215c7e8$0$35844$ed2619ec@ptn-nntp-reader02.plus.net...
    > Is it possible to use a UNC path with ChDir?
    > I want to replace:
    > ChDir "G:\Shared\Access\Project Area\Project 1"
    > with
    > ChDir "\\[Server Name]\]Share]\Project Area\Project 1"
    > This does now seem to work for me...should it?


    Hi Paul,

    No, ChDir doesn't work with UNC paths. Here's a Windows API-based
    solution. It will work with either UNC or drive letters and it will modify
    the drive and path in one call:

    Private Declare Function SetCurrentDirectoryA Lib "kernel32" _
    (ByVal lpPathName As String) As Long

    Public Sub SetUNCPath(ByVal szPathToSet As String)
    SetCurrentDirectoryA szPathToSet
    End Sub

    --
    Rob Bovey, Excel MVP
    Application Professionals
    http://www.appspro.com/

    * Take your Excel development skills to the next level.
    * Professional Excel Development
    http://www.appspro.com/Books/Books.htm



+ 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