Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default WNetGetUniversalName - how to implement in VBA?

I have a workbook on a network directory. I also happen to have the network
directory mapped on my machine, but various users may have it mapped
differently, or not at all.

I need to verify (on open) that the workbook is still located in the network
directory, and that someone hasn't moved it or saved a copy elsewhere,
because the data they enter needs to be available to all users.

I tried activeworkbook.path, fullname, and curdir, but all of those just
gave me my mapped drive letter (w:)

I did a google search and it looks like WNetGetUniversalName translates the
local path to the full network path, but for the life of me I can't get it
to work in VBA. Does anyone have a code snippet that implements this that
they would be willing to share?

Thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default WNetGetUniversalName - how to implement in VBA?

this is for VB, but should be easily adapted to Excel VBA:

http://support.microsoft.com/kb/192689/en-us
How To Get UNC Path From a Mapped Network Share's Drive Letter


easier might be to use the scripting runtime:

Sub abc()
Dim fs As Object
Set fs = CreateObject("Scripting.fileSystemObject")
For Each dr In fs.Drives
msgbox dr.DriveLetter & " - " & dr.ShareName
Next
End Sub

the above is just an example to demonstrate the objects and two of the Drive
object's properties.

--
Regards,
Tom Ogilvy






"KR" wrote:

I have a workbook on a network directory. I also happen to have the network
directory mapped on my machine, but various users may have it mapped
differently, or not at all.

I need to verify (on open) that the workbook is still located in the network
directory, and that someone hasn't moved it or saved a copy elsewhere,
because the data they enter needs to be available to all users.

I tried activeworkbook.path, fullname, and curdir, but all of those just
gave me my mapped drive letter (w:)

I did a google search and it looks like WNetGetUniversalName translates the
local path to the full network path, but for the life of me I can't get it
to work in VBA. Does anyone have a code snippet that implements this that
they would be willing to share?

Thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.



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
how to implement xbrl mariano Excel Discussion (Misc queries) 0 January 18th 06 02:00 PM
Do anyone know how to implement the function? minrufeng[_3_] Excel Programming 2 August 12th 05 07:38 PM
Is there a way to implement more than 3 conditional formats CArol Excel Worksheet Functions 3 March 11th 05 10:56 AM
How to implement an iRtdServer? Hans Guijt Excel Programming 4 October 24th 04 07:17 AM
Help WNetGetUniversalName ... in vba Joao Rodrigues Excel Programming 2 April 21st 04 10:46 AM


All times are GMT +1. The time now is 02:53 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"