Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default how can i change the Drive

Because the single-letter-mapping of a network drive will
be not be used in my company, thus the method 'ChDrive' is
not functioned in my statment. Will there be any method to
change the drive ?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default how can i change the Drive

"dinga@hk" wrote in message
...
Because the single-letter-mapping of a network drive will
be not be used in my company, thus the method 'ChDrive' is
not functioned in my statment. Will there be any method to
change the drive ?


I'm not sure I understand what you mean, but if you are looking for a
way to set the current directory to a UNC type path name then this will
work:

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

Sub SetUNCPath()
SetCurrentDirectoryA "\\SERVER\SHARE\"
End Sub

This also works for mapped drives, so you can use it in either case.

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

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default how can i change the Drive

thanks Rob for your prompt reply.

i'd try your statment but it doesn't work.

Make it clear: let's say the current drive is C:\ and
ThisWorkbook.path is located networkdrive
S:\application\..., it is required direct the user to such
path to get a file to open.

Below is the original statement:

....
ChDrive Left(ThisWorkbook.Path, 1)
ChDir ThisWorkbook.Path
filetoopen = Application.GetOpenFilename("Microsoft
Word,*.DOC,Microsoft Excel,*.XLS,Text
File,*.TXT", , "Select a document")
....

-----Original Message-----
"dinga@hk" wrote in

message
...
Because the single-letter-mapping of a network drive

will
be not be used in my company, thus the method 'ChDrive'

is
not functioned in my statment. Will there be any method

to
change the drive ?


I'm not sure I understand what you mean, but if you

are looking for a
way to set the current directory to a UNC type path name

then this will
work:

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

Sub SetUNCPath()
SetCurrentDirectoryA "\\SERVER\SHARE\"
End Sub

This also works for mapped drives, so you can use it in

either case.

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

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default how can i change the Drive

What is not working in your code? AFAIK you will have to map to network
drives to access them, thereby assigning a drive letter. This clearly
suffers the problem that computer A may map it to S and computer B to T, but
there is still a drive letter.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"dinga@hk" wrote in message
...
thanks Rob for your prompt reply.

i'd try your statment but it doesn't work.

Make it clear: let's say the current drive is C:\ and
ThisWorkbook.path is located networkdrive
S:\application\..., it is required direct the user to such
path to get a file to open.

Below is the original statement:

...
ChDrive Left(ThisWorkbook.Path, 1)
ChDir ThisWorkbook.Path
filetoopen = Application.GetOpenFilename("Microsoft
Word,*.DOC,Microsoft Excel,*.XLS,Text
File,*.TXT", , "Select a document")
...

-----Original Message-----
"dinga@hk" wrote in

message
...
Because the single-letter-mapping of a network drive

will
be not be used in my company, thus the method 'ChDrive'

is
not functioned in my statment. Will there be any method

to
change the drive ?


I'm not sure I understand what you mean, but if you

are looking for a
way to set the current directory to a UNC type path name

then this will
work:

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

Sub SetUNCPath()
SetCurrentDirectoryA "\\SERVER\SHARE\"
End Sub

This also works for mapped drives, so you can use it in

either case.

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

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *



.



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
Links to mapped drive change to refer to local hard drive SueD Links and Linking in Excel 1 May 8th 08 11:42 AM
save shows K: but there is no K drive. Can't change setting. Betshalom Excel Discussion (Misc queries) 2 May 6th 08 04:56 PM
pathnames to linked workbooks change from mapped drive to UNC occasionally Larry Wrinn Links and Linking in Excel 0 March 3rd 08 03:14 PM
Pasting a range of information from a foler on F Drive to another folder on same drive Tom Ogilvy Excel Programming 1 August 3rd 03 01:50 AM
Find links with code; change from G drive to C drive Sandy[_3_] Excel Programming 4 July 26th 03 07:24 PM


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

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

About Us

"It's about Microsoft Excel"