Sub rpt_pdf()
Dim lokasifileTemp As String
Dim namafolderTemp As String
lokasifileTemp = ActiveWorkbook.Path
namafolderTemp = lokasifileTemp & "\rpt_Temp"
If Len(Dir(namafolderTemp, vbDirectory)) = 0 Then
MkDir namafolderTemp
End If
Sheets("Olah Laporan").Select
Dim namawb As String
Dim noNIK As String
namasheet = Sheet3.Range("F39").Value
namawb = ActiveWorkbook.Path & "\rpt_Temp\" & Sheet3.Range("F39").Value & "_" & Format(Now, "yymmddhhmmss") & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
namawb, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
Exit Sub
Sheets("Olah Laporan").Copy
ActiveWorkbook.SaveAs FileName:=namawb, FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
Sheets("Olah Laporan").Select
Sheets("Olah Laporan").Name = namasheet
ActiveWorkbook.Save
ActiveWindow.Close
Dim appXL As New Excel.Application
appXL.Workbooks.Open namawb
appXL.Visible = True
End Sub
0 komentar:
Posting Komentar