I confirm I want to change the drive, the drive changes to what I want.

• As ChDrive processes only the first letter of the driveletter string, it isn't possible to supply a piped name network drive name (e.g., //NTServer/); instead, the machine your program is running on must have a drive letter mapped to the network resource using Explorer or other network commands. > Is it an option to map the network drive? I am trying to use GetOpenFilename to browse files in a directory on an NT server. Public Sub Save The network drive is \\fs950o\PO Tracking, and the drive letter is "M". Part Description; object: Required. mapped: I:\directory\subdir\file.xls I want to take into account circumstances when network drives are accessible but not mapped. So, I am having some issues getting the ChDrive & ChDir to work appropriately with Excel.Application.GetOpenFilename. I'm needing a macro that saves an excel file to a network drive and the name is from a cell value. I've got the macro to do the save name part but I'm having trouble with the file location.

But Windows supplies an API that'll work for UNC paths as well as mapped drives. As a VBA function, you can use this function in macro code that is entered through the Microsoft Visual Basic Editor. ChDrive("D") ' Make "D" the current drive. My VBA works fine if I am using mapped drive letters for network drives. The problem is > > changing the current drive and directory to find the file. Here is the macro. If that is the full path then yes it is better than \\..... which is a windows search statment - slower and can be / get nasty. This example uses the ChDrive function to change the current drive. The Microsoft Excel CHDRIVE statement allows you to change the current drive. It can be used as a VBA function (VBA) in Excel.
and not a letter > (H:\). However I may not know the network drive as the pathname to search is entered by the user (using the SHBrowseForFolder function). I don't get any errors but it doesn't save. Re: VBA Open/Save Workbook over network. The drivespec argument can be a drive letter (c), a drive letter with a colon appended (c:), a drive letter with a colon and path separator appended (c:), or any network share specification (\computer2\share1). Windows Explorer\Tools\Map Network Drive An input window opens and selections made In the Drive window, I select L \\headoffice\share (this is my default setting) In the Folder window, I select \\nthoffice\share and select Finish. ", and then end the macro. Please contact your System Administrator.

I understand that I need to use the ChDrive function in order to nominate a folder on a network drive. Remarks.

: drivespec: Required. Excel help says; "If you supply a zero-length string (""), the current drive doesn't change" So you could use something like this instead: (Saved from an old post) Option Explicit Private Declare Function SetCurrentDirectoryA Lib _ "kernel32" (ByVal lpPathName As String) As Long Sub ChDirNet(szPath As String)