ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Hi,
Using the code below i am trying to have a msgbox pop up with a message & also the number of the pdf that ive been advised wasnt found
Using the code below i am trying to have a msgbox pop up with a message & also the number of the pdf that ive been advised wasnt found
Rich (BB code):
Private Sub HyperlinkInvoiceNumber_Click()
Dim lastRow As Long
Dim myPath As String, fileName As String
myPath = "C:\Users\Ian\Desktop\REMOTES ETC\DR\DR COPY INVOICES\" 'FOLDER LOCATION OF WHERE PDF ARE SAVED
lastRow = Range("P" & Rows.Count).End(xlUp).Row
For i = 6 To lastRow
fileName = myPath & Range("P" & i).Value & "*.pdf"
If Len(Dir(fileName)) <> 0 Then 'IF THE PDF FILE EXISTS THEN
ActiveSheet.Hyperlinks.Add Range("P" & i), myPath & Dir(fileName)
Else
MsgBox "PDF DOES NOT EXIST" & p.Value, vbExclamation, "PDF IS MISSING IN THE FOLDER"
End If
Next
End Sub