Probaj sa ovom.
Public Function OtvoriFajl(Sfile As String) As Variant
'*******************************************
'Ime: OtvoriFajl (Function)
'Sadržaj: Otvaranje drugog fajla
'Ulazni parametri:Na vrhu modula postaviti sledece:
'.............................................................................................................................................................................
'Const MAX_FILENAME_LEN = 260
'Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
'.............................................................................................................................................................................
'Izlazni parametri:
'*******************************************
On Error GoTo Greska
Dim Izvrsni As String
Dim i As Integer, s2 As String
Dim a
If Dir(Sfile) = "" Or Sfile = "" Then
MsgBox "File not found!", vbCritical
Exit Function
End If
s2 = String(MAX_FILENAME_LEN, 32)
i = FindExecutable(Sfile, vbNullString, s2)
If i > 32 Then
Izvrsni = Left$(s2, InStr(s2, Chr$(0)) - 1)
Else
MsgBox "Nije povezano"
End If
Shell Izvrsni & " " & Sfile, vbNormalFocus
Izlaz:
Exit Function
Greska:
GreskaB (Err.Number)
Resume Izlaz
End Function
zxz