Microsoft Office Forums


Reply
Thread Tools Display Modes

How to find full network path in Word VBA

 
 
Paul Cox
Guest
Posts: n/a
 
      12-08-2003, 02:37 PM
I'd like to find out the start of the path, for example
"\\Mycomputer\c\folder\etc ..."
so I can see the "Mycomputer" name.

Is there a shortcut here?
Thanks for a response.
Paul

 
Reply With Quote
 
 
 
 
Jonathan West
Guest
Posts: n/a
 
      12-08-2003, 03:06 PM
If the full path is in a variable (maybe called fullpath), then the first
part of the path can be found using this function

FirstPart = Left$(FullPath, Instr(3, FullPath, "\")

--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup


"Paul Cox" <(E-Mail Removed)> wrote in message
news:br228v$l4o$07$(E-Mail Removed)...
> I'd like to find out the start of the path, for example
> "\\Mycomputer\c\folder\etc ..."
> so I can see the "Mycomputer" name.
>
> Is there a shortcut here?
> Thanks for a response.
> Paul
>


 
Reply With Quote
 
 
 
 
Paul Cox
Guest
Posts: n/a
 
      12-08-2003, 06:09 PM
Thank you for your reply.
I understand the need to extract the characters from the string.

I think the problem is to find that "fullpath" variable.
If I use the code "ActiveDocument.Name" I get the path starting with
drive letter but not the computer name.

Is a built-in code in Word VBA which will give the full path?

Jonathan West wrote:
> If the full path is in a variable (maybe called fullpath), then the first
> part of the path can be found using this function
>
> FirstPart = Left$(FullPath, Instr(3, FullPath, "\")
>


 
Reply With Quote
 
Jonathan West
Guest
Posts: n/a
 
      12-08-2003, 06:51 PM
Ah, for that, use the ActiveDocument.FullName property

--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup

"Paul Cox" <(E-Mail Removed)> wrote in message
news:br2em3$a6q$06$(E-Mail Removed)...
> Thank you for your reply.
> I understand the need to extract the characters from the string.
>
> I think the problem is to find that "fullpath" variable.
> If I use the code "ActiveDocument.Name" I get the path starting with
> drive letter but not the computer name.
>
> Is a built-in code in Word VBA which will give the full path?
>
> Jonathan West wrote:
> > If the full path is in a variable (maybe called fullpath), then the

first
> > part of the path can be found using this function
> >
> > FirstPart = Left$(FullPath, Instr(3, FullPath, "\")
> >

>


 
Reply With Quote
 
Paul Cox
Guest
Posts: n/a
 
      12-09-2003, 10:22 AM
On my machine a message box to show the property
ActiveDocument.FullName property
only gives something like
"C:\myfiles\thisdocument.doc"

For me this is the local path and not the full
network path to the document.

What I am looking for is the information
"\\ComputerName\C\myfiles\thisdocument.doc"
so that then I can extract the information
"\\ComputerName".

Is there a simple way to get this network path
to the document?


Jonathan West wrote:
> Ah, for that, use the ActiveDocument.FullName property
>


 
Reply With Quote
 
Jonathan West
Guest
Posts: n/a
 
      12-09-2003, 01:04 PM
Hi Paul,

If the file is stored on a local drive, then as far as I know there isn't an
automatic way of getting the computer & sharename, you'll have to do the
replacement yourself, knowing what shares are available.

If the file is on a network drive which happens to be mapped to a drive
letter, then you can get the full UNC pathname this way

UNCName = WordBasic.FileNameInfo$(ActiveDocument.FullName, 6)

--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup


"Paul Cox" <(E-Mail Removed)> wrote in message
news:br47nn$hhk$02$(E-Mail Removed)...
> On my machine a message box to show the property
> ActiveDocument.FullName property
> only gives something like
> "C:\myfiles\thisdocument.doc"
>
> For me this is the local path and not the full
> network path to the document.
>
> What I am looking for is the information
> "\\ComputerName\C\myfiles\thisdocument.doc"
> so that then I can extract the information
> "\\ComputerName".
>
> Is there a simple way to get this network path
> to the document?
>
>
> Jonathan West wrote:
> > Ah, for that, use the ActiveDocument.FullName property
> >

>


 
Reply With Quote
 
Paul Cox
Guest
Posts: n/a
 
      12-09-2003, 05:57 PM
A solution is also available at:
http://www.mvps.org/access/api/api0009.htm
This successfully produces the characters of the computer name.
--------------

Jonathan West wrote:
> Hi Paul,
>
> If the file is stored on a local drive, then as far as I know there isn't an
> automatic way of getting the computer & sharename, you'll have to do the
> replacement yourself, knowing what shares are available.
>
> If the file is on a network drive which happens to be mapped to a drive
> letter, then you can get the full UNC pathname this way
>
> UNCName = WordBasic.FileNameInfo$(ActiveDocument.FullName, 6)
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I PREVENT text in emails from being different sizes and some bolded? damaniwvk@gmail.com Outlook General 2 05-19-2013 06:58 PM
Re: how do you write the degrees symbol in excel? muhammadali1319@gmail.com Excel Misc 0 05-19-2013 10:51 AM
Drive path vs. Network Path S:\Shared\Folder vs. \\NETWORK\USER\FO Author Access VBA Modules 4 08-28-2008 04:31 PM
How do I create a Link Table from a reference path(not full path)? troubledHC Access General 1 06-14-2005 08:42 AM


All times are GMT. The time now is 06:10 PM.
Microsoft Office Forums is not affiliated with Microsoft Corporation.


Welcome!
Welcome to the Microsoft Office Forums
 


Latest Threads
Mail Merging Content With High Quality
oleander (Yesterday, 11:59 PM)

Aargh. What is this?
PeteJ (Yesterday, 12:10 PM)

Word 2013 Insert Symbol (Not Responding)
tpthrshr (Yesterday, 02:49 AM)

Can't save a large Word document
Josh (Yesterday, 01:03 AM)

Remote help?
newman200 (04-13-2014, 12:54 PM)