#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default UNC Paths

"Paul Smith" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paths for macros Tendresse Excel Discussion (Misc queries) 15 August 8th 07 02:50 AM
Paths Ross[_2_] New Users to Excel 1 April 4th 07 11:35 PM
I hate paths! Ross[_2_] Excel Discussion (Misc queries) 2 April 4th 07 10:14 PM
Help with filenames and paths. jim9912 Excel Discussion (Misc queries) 2 March 30th 06 05:52 PM
file paths hr Excel Discussion (Misc queries) 0 December 7th 05 04:59 PM


All times are GMT +1. The time now is 08:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"