Private Sub Command101_Click()
On Error GoTo Err_Command101_Click
Dim stDocName As String
Dim sFile As String
Dim sDir As String
Dim Path As String
Dim sSite As String
Dim fso As New Scripting.FileSystemObject
Dim fls As Folders, fl As Folder
stDocName = "open By Site Name"
DoCmd.RunMacro stDocName
If stDocName = True Then
Set fls = fso.GetFolder("D:\SAP - Private Sites LA\").SubFolders
sSite = "D:\SAP - Private Sites LA\"
sDir = ""
sFile = Me.Site_Name & ".pdf"
sPath = sSite & sDir & sFile
If Dir$(sPath) <> "" Then
FollowHyperlink sPath
Else
MsgBox "Cannot locate file " & sPath
End If
For Each fl In fls
sPath = fl.Path & "\" & sFile
If Dir$(sPath) <> "" Then
FollowHyperlink sPath
Else
'MsgBox "Cannot locate file " & sPath
End If
Next
End If
Exit_Command101_Click:
Exit Sub
Err_Command101_Click:
MsgBox Err.Description
Resume Exit_Command101_Click
End Sub
|