Cuong Servenet > 14-08-18, 02:14 PM
Private Sub OpenPath1_Click()
Dim FileName As Long
With Application.FileDialog(msoFileDialogOpen)
.Title = "Chon File"
.Filters.Clear
.Filters.Add "Tat ca cac file", "*.*"
.AllowMultiSelect = False
.InitialFileName = CurrentProject.Path
.InitialFileName = CurrentProject.Name
If .Show = -1 Then
Me!FILE_PATH = .SelectedItems(1)
FileName = InStrRev(Me!FILE_PATH, "\")
Me!FILE_NAME = Mid(Me!FILE_PATH, FileName + 1)
End If
End With
End Sub
Private Sub OpenFILE1_Click()
On Error GoTo Err_Step
Dim filepath As String
Dim fFso As Object
If Nz(Me!FILE_PATH, "") = "" Then
MsgBox "xyz_abc & Chr(13) & Chr(13) & Chr(10) & _
"chon duoi file", vbExclamation, "khong co file"
Exit Sub
Else
filepath = Me!FILE_PATH
Set fFso = CreateObject("Scripting.FileSystemObject")
If (fFso.FileExists(filepath) = True) Then
Application.FollowHyperlink filepath
Else
MsgBox "abc_xyz" & Chr(13) & Chr(13) & Chr(10) & _
"ABCSEF", vbExclamation, "ZZZZZZZZZZZZ"
Exit Sub
End If
Set fFso = Nothing
End If
Exit_Step:
Exit Sub
Err_Step:
MsgBox Err.Description, vbCritical
Resume Exit_Step
End Sub