Below is my code to select and open Excel files. Can someone modify it to include showing Word documents and be able to open them as well? I added this: "Word Documents (*.doc),*.doc," which showed the Word files, but I got an error message when I tried to open the Word documents.
Sub ()
Dim fn As Variant
ChDir "C:\Documents"
fn = Application.GetOpenFilename("Excel-files,*.xls", _
1, "Technician Technical Information - Select folder and file to open", , False)
If TypeName(fn) = "Boolean" Then Exit Sub
' the user didn't select a file
Debug.Print "Selected file: " & fn
Workbooks.Open fn
End Sub
Thanks!
Sub ()
Dim fn As Variant
ChDir "C:\Documents"
fn = Application.GetOpenFilename("Excel-files,*.xls", _
1, "Technician Technical Information - Select folder and file to open", , False)
If TypeName(fn) = "Boolean" Then Exit Sub
' the user didn't select a file
Debug.Print "Selected file: " & fn
Workbooks.Open fn
End Sub
Thanks!