ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Path Name issue for file opened from Z drive (https://www.excelbanter.com/excel-programming/415696-path-name-issue-file-opened-z-drive.html)

Barb Reinhardt

Path Name issue for file opened from Z drive
 
I have mapped server \\server\ to my Z drive. When I open files from this
mapped drive and display the workbook.path, it doesn't show Z, but it shows
\\server\filename.xls. Is there some way to have it keep the Z drive without
hard coding the mapping?

Thanks,
Barb Reinhardt


Gary''s Student

Path Name issue for file opened from Z drive
 
Maybe its the mapping technique. From a command window issue:

net use Z: /delete /y
net use Z: "\\server\" /PERSISTENT:yes

Of course, make sure the full server path is in the second command. The
commands can be put in a .bat or a .wsh file, if you prefer.

Then from My Computer, open the Z: drive and then open the Excel file by
double-clicking the icon.

Then:

Sub ordinate()
MsgBox (ThisWorkbook.Path)
End Sub




--
Gary''s Student - gsnu200800


"Barb Reinhardt" wrote:

I have mapped server \\server\ to my Z drive. When I open files from this
mapped drive and display the workbook.path, it doesn't show Z, but it shows
\\server\filename.xls. Is there some way to have it keep the Z drive without
hard coding the mapping?

Thanks,
Barb Reinhardt


Barb Reinhardt

Path Name issue for file opened from Z drive
 
Wonderful! It's remapped when I'm connected to the Office network, but when
I'm working offsite, I have to remap it myself, otherwise I can't get to
anything programmatically. This is a snippet of code that I use when I map
it offsite in a VBScript file. Is there something I should change.
Admittedly, I'm not a VBScript expert.

Set objNetwork = Wscript.CreateObject("WScript.Network")
strUserName = objNetwork.UserName

on error resume next
objNetwork.MapNetworkDrive strdirectory, strpath & strusername

Thanks,
Barb Reinhardt



"Gary''s Student" wrote:

Maybe its the mapping technique. From a command window issue:

net use Z: /delete /y
net use Z: "\\server\" /PERSISTENT:yes

Of course, make sure the full server path is in the second command. The
commands can be put in a .bat or a .wsh file, if you prefer.

Then from My Computer, open the Z: drive and then open the Excel file by
double-clicking the icon.

Then:

Sub ordinate()
MsgBox (ThisWorkbook.Path)
End Sub




--
Gary''s Student - gsnu200800


"Barb Reinhardt" wrote:

I have mapped server \\server\ to my Z drive. When I open files from this
mapped drive and display the workbook.path, it doesn't show Z, but it shows
\\server\filename.xls. Is there some way to have it keep the Z drive without
hard coding the mapping?

Thanks,
Barb Reinhardt


Gary''s Student

Path Name issue for file opened from Z drive
 
I don't know.
--
Gary''s Student - gsnu200800


"Barb Reinhardt" wrote:

Wonderful! It's remapped when I'm connected to the Office network, but when
I'm working offsite, I have to remap it myself, otherwise I can't get to
anything programmatically. This is a snippet of code that I use when I map
it offsite in a VBScript file. Is there something I should change.
Admittedly, I'm not a VBScript expert.

Set objNetwork = Wscript.CreateObject("WScript.Network")
strUserName = objNetwork.UserName

on error resume next
objNetwork.MapNetworkDrive strdirectory, strpath & strusername

Thanks,
Barb Reinhardt



"Gary''s Student" wrote:

Maybe its the mapping technique. From a command window issue:

net use Z: /delete /y
net use Z: "\\server\" /PERSISTENT:yes

Of course, make sure the full server path is in the second command. The
commands can be put in a .bat or a .wsh file, if you prefer.

Then from My Computer, open the Z: drive and then open the Excel file by
double-clicking the icon.

Then:

Sub ordinate()
MsgBox (ThisWorkbook.Path)
End Sub




--
Gary''s Student - gsnu200800


"Barb Reinhardt" wrote:

I have mapped server \\server\ to my Z drive. When I open files from this
mapped drive and display the workbook.path, it doesn't show Z, but it shows
\\server\filename.xls. Is there some way to have it keep the Z drive without
hard coding the mapping?

Thanks,
Barb Reinhardt



All times are GMT +1. The time now is 01:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com