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,852
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,077,731
Messages
5,335,893
Members
399,056
Latest member
CityGirlLuv

Some videos you may like

This Week's Hot Topics

Top