Kemidan2014
Board Regular
- Joined
- Apr 4, 2022
- Messages
- 229
- Office Version
- 365
- Platform
- Windows
I decided to change an onclick event to behave from opening an excel tile to opening the directory that file would be in so that all the files that would have been placed there are readily accessible.
Google research offered up some coding using Shell method. but when I run it i get Run time error 53 file not found but the directory DOES exist. So i dont know if this is an issue where i am searching for a file thats located on a network drive or not.
Here is the code
Google research offered up some coding using Shell method. but when I run it i get Run time error 53 file not found but the directory DOES exist. So i dont know if this is an issue where i am searching for a file thats located on a network drive or not.
Here is the code
VBA Code:
Private Sub OpenA3_Click()
Dim foldername As String
Dim sfilename As String
'Dim sfolderexists As String
'Dim excelapp As Object
'Set excelapp = CreateObject("Excel.Application")
foldername = Me.[QIMS#]
'sfilename = "O:\1_All Customers\Current Complaints\Complaint Folders" & "\" & foldername & "\" & foldername & ".xls"
sfilename = "O:\1_All Customers\Current Complaints\Complaint Folders" & "\" & foldername & "\."
If Dir(sfilename, vbDirectory) = "" Then
MsgBox ("Complaint folder Does not exist!")
'MsgBox ("A3 Does not exist!")
Exit Sub
End If
Shell "C:\Windows\explorer.exe """ & sfilename & "", vbNormalFocus
'excelapp.Workbooks.Open (sfilename)
'excelapp.Visible = True
'Set excelapp = Nothing
End Sub