View Full Version : Vb 6.0 question


TheDisturbedOne
04-06-2003, 02:32 PM
how do you make a link vb 6.0? oh this is the only place i could post this question

erictheman
04-06-2003, 05:38 PM
Function PathFromURL(iURL As String) As String
' Function Name: PathFromURL
' Pass in a single filename (iURL) and return the full path to that
' file. This works when you run on a local computer (for testing
' purposes or running from IDE) or when running from a Web server.

Dim navPath As String
Dim intLocal As Integer

' Check if there is an absolute URL being passed in.
' If so, return that URL.

If InStr(iURL, "://") Or InStr(iURL, ":\\") Then
PathFromURL = iURL
Else
' Find the last "/"
intLocal = InStrRev(UserDocument.Parent.locationname, "/")

If (intLocal = 0) Then
' If there is not a "/", we are running on the local computer.
navPath = App.Path
Else
' We are running on the Web server, use locationname to get
' the current path.
navPath = Left(UserDocument.Parent.locationname, intLocal - 1)
End If

' Append the requested file name to the path for the
' absolute URL.
PathFromURL = navPath & "/" & iURL
End If
End Function