Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Links to mapped drive change to refer to local hard drive | Links and Linking in Excel | |||
save shows K: but there is no K drive. Can't change setting. | Excel Discussion (Misc queries) | |||
pathnames to linked workbooks change from mapped drive to UNC occasionally | Links and Linking in Excel | |||
Pasting a range of information from a foler on F Drive to another folder on same drive | Excel Programming | |||
Find links with code; change from G drive to C drive | Excel Programming |