Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Path Autotext -- No Drive Letter please!

Status
Not open for further replies.

luciai

Programmer
Jul 25, 2002
13
CA
Is there a way to modify the autotext "file path" in Word to show no drive letter?
 
Do you mean show all the path, but no drive letter? I am not sure why you would want the path without the drive letter. The syntax for path imcludes the drive. However, tecnically speaking, what is returned by AutoText is, in fact, text, and therefore can be edited. And certainly you could have a macro parse through the returned "file and path", and remove the drive letter, but it seems more work than it is worth. Do you want to remove the : as well? The first "\"?

Do you just want the file name?

Gerry
 
Hi Gerry,

I want to show all the file path except the "C:\". I would like to create that autotext so that it will be include in the footer of our documents to show internally. Thanks!
 
Hi,

The filename field only gives you a full filename with/without the full path. There's no option for displaying the path without the drive details. You would need to use a macro for that.

Cheers
 
The following macro displays a message box with the path, no drive letter. Message is just a string, so you could use it further, as needed.

Sub ShowPathNoDrive()
' note this assumes path is NOT UNC
' if UNC then would need more editing
' to pick out just local path on sever

Dim filenamepath As String
Dim pathlength As Integer
' path string
filenamepath = ActiveDocument.FullName
pathlength = Len(filenamepath) - 3 ' 'drive:\"
MsgBox Right(filenamepath, pathlength)
End Sub




Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top