I have deployed a Daily Time Record (DTR) system to the field using excel vba. Unfortunately, there are these colleagues who are not so faithful to their work. I have found out that some of them simply edited the PDF generated DTR. Can anyone help me with this?
Here are the codes that I have been using for almost 2 years already.
Thank you so much. Any help is appreciated very much.
Here are the codes that I have been using for almost 2 years already.
Code:
Sub SavePDF()
Dim sRange1 As String
Dim sRange2 As String
Dim sPace As String
Dim rngRange As Range
Dim strFilename, strDirname, strPathname, strDefpath As String
On Error Resume Next
sRange1 = ActiveSheet.Range("F9")
sRange2 = ActiveSheet.Range("Z13")
sPace = (" DTR ")
strDirname = sRange1 + sPace + sRange2
Set rngRange = Worksheets("DTR").Range("C6")
strFilename = rngRange.Value & Format(Now(), " mmddyyyy")
strDefpath = Application.ActiveWorkbook.Path
If IsEmpty(strDirname) Then Exit Sub
If IsEmpty(strFilename) Then Exit Sub
If rngRange.Value <= "" Then Exit Sub
MkDir strDefpath & "\" & strDirname
strPathname = strFilename
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strDefpath & "\" & strDirname & "\" & strFilename & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False2
End Sub
Thank you so much. Any help is appreciated very much.