Convert a Word file to PDF using activePDF Server

Note:
This solution requires the component to be installed first.
To download the installer,
click here
Introduction
The following VBScript example demonstrates how to convert a Microsoft® Word document to PDF using activePDF Server.
Detail
VBScript
' Get local path as varPath
arrayScr = Split(WScript.ScriptFullName, "\", -1, 1)
For i = 0 to UBound(arrayScr) - 1
varPath = varPath & arrayScr(i) & "\"
Next
' Define Variables
' PDF output name
varPDFName = "word.pdf"
' Word File To Convert
varWordFile = "word.doc"
' Timeout for Wait
varTimeout = 60
' Instantiate Object
Set APS = CreateObject("APServer.Object")
' Set Server Properties
APS.OutputDirectory = varPath
APS.NewDocumentName = varPDFName
' Tell Server to begin the print process
varReturn = APS.StartPrinting()
If varReturn <> 0 Then Error("StartPrinting") End If
' Word Automation
Set WordObject = CreateObject("Word.Application")
WordObject.DisplayAlerts = False
Set NewDoc = WordObject.Documents.Open((varPath & varWordFile), False, True)
Set WordDialog = WordObject.Dialogs(97)
WordDialog.Printer = APS.NewPrinterName
WordDialog.DoNotSetAsSysDefault = 1
WordDialog.Execute
NewDoc.PrintOut False
NewDoc.Close False
WordObject.Quit False
Set WordObject = Nothing
' Tell Server to end the print process
varReturn = APS.StopPrinting()
If varReturn <> 0 Then Error("StopPrinting") End If
' Wait for the conversion results
varReturn = APS.Wait(varTimeout)
If varReturn <> 0 Then Error("Wait") End If
' Clear Server Object
Set APS = Nothing
' Conversion Successful
Msgbox "Done!"
' Error Handling
Sub Error(Method)
Msgbox "'" & Method & "' failed with a '" & varReturn & _
"'" & VBCRLF & "KB article on Return codes:" & VBCRLF & _
"http://www.activepdf.com/support/knowledgebase/viewKb.cfm?id=10549&tk=ts"
Set APS = Nothing
Wscript.Quit
End Sub
Visit
activePDF
for more information and more samples.