Custom time format using a VB Script macro / PDF Printer
This example will show you how to create a custom macro value that can be used in file names and other PDF settings with support for macros.
The code below shows a VBScript function that returns a string representation of the current time. We will save the function in a vbs file named
time.vbs and place it in the
macros folder of the PDF Printer. You can find the
macros subfolder of the program folder of the PDF Printer.
- Rem -- Return the current time in HHMMSS format
- Function TimeHHMMSS()
- Dim retv, d
- d = Now
- retv = Right("00" & Hour(d), 2) & Right("00" & Minute(d), 2) & Right("00" & Second(d), 2)
- TimeHHMMSS = retv
- End Function
All functions in the macro vbs file can be referenced once the macro file is in place. In case we want to use the new macro in the creation of the PDF output file name then we can open the options dialog and enter string shown below in the file name input field:
Download Example Files
You can download and run the example yourself. The files needed are available here. The VBS file must be placed in the macros sub folder of the PDF Printer installation. You can use the MacroDir setting to change the location of the VBS files if needed.
|Example file||361 Bytes|