call section (C:\Program Files) (1 Viewer)

azhar2006

Registered User.
Local time
Today, 03:28
Joined
Feb 8, 2012
Messages
202
Good evening guys
I am trying to call section (C:\Program Files) of the computer through a button and display its contents only. I used this code that I found in the forum for the colleague (arnelgp) but it did not work.
Code:
Dim strPath As String
strPath = ""
If Len(strPath) Then
    strPath = getPath(strPath)
Else
strPath = Environ$("C:\Program Files")
End If
Application.FollowHyperlink strPath



Public Function getPath(ByVal p As String)
Dim sPath As String
Dim i As Integer
i = InStrRev(p, "\")
sPath = Left$(p, i)
getPath = sPath
End Function
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:28
Joined
May 7, 2009
Messages
19,226
if strpath is Constant, you do not need Environ$() for it:

Dim strPath As String
strPath = ""
If Len(strPath) Then
strPath = getPath(strPath)
Else
strPath = "C:\Program Files\"
End If
Application.FollowHyperlink strPath
 

azhar2006

Registered User.
Local time
Today, 03:28
Joined
Feb 8, 2012
Messages
202
if strpath is Constant, you do not need Environ$() for it:

Dim strPath As String
strPath = ""
If Len(strPath) Then
strPath = getPath(strPath)
Else
strPath = "C:\Program Files\"
End If
Application.FollowHyperlink strPath
Thank you very much, dear (arnelgp)
 

Users who are viewing this thread

Top Bottom