bamaisgreat
Well-known Member
- Joined
- Jan 23, 2012
- Messages
- 831
- Office Version
- 365
- Platform
- Windows
Is it possible to have a macro in my personal workbook that will open a pdf named job list thats in a certain folder.
Private Declare PtrSafe Function ShellExecute _
Lib "Shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As LongPtr, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As LongPtr
Sub OpenPDF()
Dim args As String
Dim File As String
Dim Folder As String
Dim ret As Long
File = "Test.pdf"
Folder = "C:\Users\Owner\Documents"
args = "/A ""pagemode=none&toolbar=0&statusbar=0"""
ret = ShellExecute(0&, "open", File, args, Folder, 1&)
End Sub
Sub openJOBLIST()
ThisWorkbook.FollowHyperlink "\\hq\dfsdata\Data\UserHomes\jamey.eerson\My Documents\pdf-NEW\Latest Job List\Job List.pdf"
End Sub
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