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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX vdb files when running program

Status
Not open for further replies.

mwiner

IS-IT--Management
Joined
Oct 24, 2002
Messages
266
Location
US
Ok I have recently converted my Standard EXE to an ActiveX application. I am actually learning this as I go so I am having some dificulties. (I need to pick up a good book).

Anyway. I have started going through the code and changing any non-ActiveX code to ActiveX. I have started with my "Next" and "Back" buttons. Seems to be the easiest. Here is my issue. In Visual Basic if I click "start" to run the program it puts all the vdb files in:
C:\Program Files\Microsoft Visual Studio\VB98
However if I make .exe it puts them in the same folder as the exe that is created. I am trying to click "next" and make it go to the next ActiveX Doc. Well I am using the Hyperlink.NavigateTo command to point to the correct spot. However, when testing the .vdb are going to be in a different place then the final version. I do not want to use exact paths to the vdb files. I would like to keep everything relative paths. I have tried app.path but it does not point to the right spot.

Any ideas on how I can reference to these files?

Thanks!

-Matt
 
App.Path should point to the same folder as the one that the running exe is in. What is the "right spot" that it doesn't point to?

Bob
 
Try this:

UserDocument.Hyperlink.NavigateTo PathFromURL("yourfile.vbd")

Function PathFromURL(iURL As String) As String
On Error GoTo err_handler

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

Exit Function

err_handler:
'Your error handling goes here!
Exit Function
End Function

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top