- Excel VBA 質問スレ Part42©2ch.net [無断転載禁止]©2ch.net
662 :デフォルトの名無しさん[sage]:2016/08/16(火) 11:04:25.52 ID:Yz8XnW51 - >>655 >>660
やりたい事こんな感じ? 例えば Zドライブに\\サーバー名\hoge が割り当てられていて Z:\moge\test.xlsmを開いている時 パスとして \\サーバー名\hoge\moge が欲しいって事なのかな? Const NetworkDrive As Long = 3 Set FSO = CreateObject("Scripting.FileSystemObject") Set MyFolder = FSO.GetFile(ThisWorkbook.FullName).ParentFolder Set MyDrive = MyFolder.Drive MyPath = MyFolder.Path If MyDrive.DriveType = NetworkDrive And MyDrive.DriveLetter <> "" Then MyPath = Replace(MyPath, MyDrive.Path, MyDrive.ShareName) End If Debug.Print MyPath
|
|