By pressing on a checkbox I like to show a list of files (*.doc, *.pdf, *.xls) which are located in a directory which is build up from two Cells (A1 = Number and A2 = Name Client). The user can then choose one of the documents for review purposes (read only).
Since I’m new to VBA I found a code which partly works but it doesn’t go to that directory and it rejects any other docs then *.xls.
This is the code I use:
Sub Docs_Click()
NewFN = Application.GetOpenFilename(FileFilter:="Files (*.xls;*.doc), *.xls;*.doc", Title:="Please select a file")
If NewFN = False Then
'They pressed Cancel
Exit Sub
Else
Workbooks.Open Filename:=NewFN
End If
End Sub
Since I’m new to VBA I found a code which partly works but it doesn’t go to that directory and it rejects any other docs then *.xls.
This is the code I use:
Sub Docs_Click()
NewFN = Application.GetOpenFilename(FileFilter:="Files (*.xls;*.doc), *.xls;*.doc", Title:="Please select a file")
If NewFN = False Then
'They pressed Cancel
Exit Sub
Else
Workbooks.Open Filename:=NewFN
End If
End Sub