convert absolute to relative path

ThomW

New member
Local time
Today, 12:52
Joined
Jan 4, 2012
Messages
3
hello,
I know I'm not the first who's asking about this,
but im not a experience vba'er and for so far i can't fix what i want to do..

I've a form with a button that opens a flash projector.
everything works, but i'm using this on several places, so for me it's a solution to change the absolute path into a relative.

the vba code:

Private Sub plattegrond_Click()
On Error GoTo Err_plattegrond_Click
Dim stAppName As String
stAppName = "H:\Databases\pc_registratie\plat_blit_new.exe"
Call Shell(stAppName, 1)
Exit_plattegrond_Click:
Exit Sub
Err_plattegrond_Click:
MsgBox Err.Description
Resume Exit_plattegrond_Click

End Sub

I hope somebody can pick me in the right direction.

Grtz,
Thom
 
so for me it's a solution to change the absolute path into a relative.

Do you mean that you have to support the program being found on different drive letters or different paths?

If so, then I would break up the creation of the full path. Have some code determine the correct drive letter / path, and concatenate that piece onto what ever you can deem static... perhaps that is only the EXE filename.
 
I'm guessing H: drive is a shared network drive and you mean some people might have it mapped to a different drive letter? (Apologies if I've misunderstood).

Anyway, you could replace H: with \\ServerName\ShareName

For example, our work NAS is called Nas-02 and we have a share called Databases. I could have this mapped to H: and could use just H: to reference it but I would always use: \\Nas-02\Databases instead in case other people have it mapped to a different drive letter.

Hope this helps (assuming I've understood you correctly)
 
Do you mean that you have to support the program being found on different drive letters or different paths?

If so, then I would break up the creation of the full path. Have some code determine the correct drive letter / path, and concatenate that piece onto what ever you can deem static... perhaps that is only the EXE filename.

Thnx for replying,
the exe is in the same folder as the database,
for example i have a copy of the database on a usb device,
the path is then: D:databases/pc_registratie/plat_blit_new.exe

so what i wanno do is, if possible, trace and point to the exe file.
 
Last edited:
stAppName = CurrentProject.Path & "\plat_blit_new.exe "

JR
 

Users who are viewing this thread

Back
Top Bottom