Please I am new in VBA access database and my background programming language has been focused on C#
I have a task to launch a specific file name (all files in doc, xls, etc) from the same directory path when the user click on a button for each specific file name.
I have been googling and used different approach still it seemed not to work.
I tried this:
Private Sub FileMsReports_Click()
Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For i = 1 To f.SelectedItems.Count
sFile = FileName(f.SelectedItems(i), sPath)
MsgBox sPath & "---" & sFile
Next
End If
End Sub
Public Function FileName(ByVal strPath As String, sPath) As String
sPath = Left(strPath, InStrRev(strPath, "\"))
FileName = Mid(strPath, InStrRev(strPath, "\") + 1)
End Function
I ended up getting a file dialog show up but it is not actually what my supervisor wanted me to do!
I am still like less a year in programming and right now this is a task giving to me for the place of my Practicum.
Please I need someone to help me out and direction on how to go about this.
Thanks in advance.