Multiply Certificate and save AUTO to PDF || TUTORIALS || FREE

Опубликовано: 18 Октябрь 2024
на канале: DirgA_Channel
4,885
131

Video Tutorials to create and save certificates to pdf format with their respective names.
must read :
FOLDER_SAVED is the folder where the results will be saved later
SOURCE_FILE_PATH is a folder containing excel files
if there is an error or fail do not hesitate to leave a comment.

Copy Code/Scrift setelah garis di bawah :
-----------------------------------------
Option Explicit

Const FOLDER_SAVED As String = "D:\DATA\"
Const SOURCE_FILE_PATH As String = "D:\DATA\contohnama.xlsx"

Sub RMSaveAsFileName()
Dim MainDoc As Document, TargetDoc As Document
Dim dbPath As String
Dim recordNumber As Long, TotalRecord As Long

Set MainDoc = ActiveDocument
With MainDoc.MailMerge

.OpenDataSource Name:=SOURCE_FILE_PATH, sqlstatement:="SELECT * FROM [NamaSheet1$]"

TotalRecord = .DataSource.RecordCount

For recordNumber = 1 To TotalRecord

With .DataSource
.ActiveRecord = recordNumber
.FirstRecord = recordNumber
.LastRecord = recordNumber
End With

.Destination = wdSendToNewDocument
.Execute False

Set TargetDoc = ActiveDocument

TargetDoc.ExportAsFixedFormat FOLDER_SAVED & .DataSource.DataFields("nama kolom peserta").Value & ".pdf", exportformat:=wdExportFormatPDF

TargetDoc.Close False

Set TargetDoc = Nothing

Next recordNumber

End With

End Sub
--------------------------------------

Support me by like and subcribe