VBA: Open PDF with GGS in filename

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
784
I was wandering if someone could help me edit the code below to open the pdf in the file that has the letters GGS in the file name?

Public Sub openJOBLIST()

Dim path As String
Dim PDFfile As String

path = "\\hq\dfsdata\Data\UserHomes\jamey.eerson\My Documents\pdf-NEW\Latest Job List"
If Right(path, 1) <> "" Then path = path & ""

PDFfile = Dir(path & "*.pdf")
If PDFfile <> vbNullString Then
ThisWorkbook.FollowHyperlink path & PDFfile
End If

End Sub
 

Leith Ross

Well-known Member
Joined
Mar 17, 2008
Messages
1,858
Office Version
2010, 2007
Platform
Windows
Hello bamaisgreat,

If you only have one PDF file with GGS in the file name then this will work...
Code:
Public Sub openJOBLIST()


    Dim path    As String
    Dim PDFfile As String


        path = "\\hq\dfsdata\Data\UserHomes\jamey.eerson\My Documents\pdf-NEW\Latest Job List"
        If Right(path, 1) <> "" Then path = path & ""


        PDFfile = Dir(path & "*GGS*.pdf")


        If PDFfile <> vbNullString Then
            ThisWorkbook.FollowHyperlink path & PDFfile
        End If


End Sub
 
Last edited:

Forum statistics

Threads
1,078,370
Messages
5,339,789
Members
399,325
Latest member
smilevenki

Some videos you may like

This Week's Hot Topics

Top