ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Morning,
The code in use is shown below
The user sees the Msgbox saying
INVOICE WAS NOT SAVED AS IT ALLREADY EXIST,
PLEASE CHECK FILE IN FOLDER THAT WILL NOW OPEN.
Now the folder where the pdf is stored is opened.
I would like the pdf in question to be selected.
The code in use is shown below
The user sees the Msgbox saying
INVOICE WAS NOT SAVED AS IT ALLREADY EXIST,
PLEASE CHECK FILE IN FOLDER THAT WILL NOW OPEN.
Now the folder where the pdf is stored is opened.
I would like the pdf in question to be selected.
Rich (BB code):
Private Sub CommandButton2_Click()
Dim sPath As String, strFileName As String
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DR\DR COPY INVOICES TEST\" & Range("L4").Value & ".pdf"
If Range("L18") = "" Then
MsgBox ("PLEASE SELECT A PAYMENT TYPE "), vbCritical, "PAYMENT TYPE WAS NOT SELECTED"
Range("L18").Select
Exit Sub
End If
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DR\DR COPY INVOICES TEST\" & Range("L4").Value & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "INVOICE " & Range("L4").Value & " WAS NOT SAVED AS IT ALLREADY EXISTS" & vbNewLine & vbNewLine & "PLEASE CHECK FILE IN FOLDER THAT WILL NOW OPEN.", vbCritical + vbOKOnly, "INVOICE NOT SAVED MESSAGE"
Dim strFolder As String
strFolder = "C:\Users\Ian\Desktop\REMOTES ETC\DR\DR COPY INVOICES TEST\"
ActiveWorkbook.FollowHyperlink Address:=strFolder, NewWindow:=True
Exit Sub
End If
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, fileName:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
End With
End Sub