I found the attached macro and Vb that lets me search for and open a xlsm file from with a folder. How would i adapt it to search for and open a .pdf file instead of an excel file?
Many thanks.. I'm slowly learning this stuff.
Mod Edit: Tag Code
Many thanks.. I'm slowly learning this stuff.
Code:
Public Function ISWBOPEN(wbName As String) As Boolean
'Originally found written by Jake Marx
On Error Resume Next
ISWBOPEN = Len(Workbooks(wbName).Name)
End Function
Sub Open_Saved_Quote()
Dim WB As Workbook
Dim strFile As String, sName As String
ChDrive "C:\Quotes Folder\"
ChDir "C:\Quotes Folder\"
strFile = Application.GetOpenFilename(FileFilter:="Excel Files (*.xlsm), *.xlsm", Title:="Please select from a saved quotes file")
If strFile = "False" Then
'They pressed Cancel
MsgBox "Stopping because you did not select a file"
Else
sName = Right(strFile, Len(strFile) - InStrRev(strFile, Application.PathSeparator))
If ISWBOPEN(sName) = True Then
Set WB = Workbooks(sName)
Else
Set WB = Workbooks.Open(strFile)
End If
End If
End Sub
Mod Edit: Tag Code
Last edited by a moderator: