Converting Microsoft Outlook Messages to TIFF for Microsoft Visual Basic 6.0
'----------------------------------------------------------------------
' 1) Microsoft Outlook 2000 or above should be installed and activated on your PC.
'
' 2) Universal Document Converter 5.2 or above should be installed, too.
'
' 3) Open your project in Microsoft Visual Basic 6.0.
'
' 4) In Visual Basic main menu press "Project->References".
'
' 5) In the list of references check "Universal Document Converter Type Library".
'----------------------------------------------------------------------Private Sub WaitSomeTime(nSec As Single)
Dim nStart, nFinish As Single
nStart = Timer ' Set start time.Do While Timer < nStart + nSec
DoEvents ' Yield to other processes.Loop
nFinish = Timer ' Set end time.End SubPrivate Sub PrintOutlookMsgToTIFF(ByVal strFilePath As String)
Const olDiscard = 1 ' = Outlook.OlInspectorClose.olDiscardDim objUDC As IUDC
Dim itfPrinter As IUDCPrinter
Dim itfProfile As IProfile
Dim objOutlook As ObjectDim itfMsg As ObjectSet objUDC = New UDC.APIWrapper
Set itfPrinter = objUDC.Printers("Universal Document Converter")
Set itfProfile = itfPrinter.Profile
' Set Universal Document Converter as default printer, because
' Outlook's API interface allow printing only on default printer
objUDC.DefaultPrinter = "Universal Document Converter"
' Use Universal Document Converter API to change settings of converterd document
itfProfile.FileFormat.ActualFormat = FMT_TIFF
itfProfile.FileFormat.TIFF.ColorSpace = CS_BLACKWHITE
itfProfile.FileFormat.TIFF.Compression = CMP_CCITTGR4
itfProfile.OutputLocation.Mode = LM_PREDEFINED
itfProfile.OutputLocation.FolderPath = "C:\Out"
itfProfile.PostProcessing.Mode = PP_OPEN_FOLDER
' Open MS Outlook as COM-serverSet objOutlook = CreateObject("Outlook.Application")
' Open Outlook MSG fileSet itfMsg = objOutlook.CreateItemFromTemplate(strFilePath)
' And print it on the default printerCall itfMsg.PrintOut
' Close opened file
itfMsg.Close (olDiscard)
' Wait until Outlook finished printing process
WaitSomeTime (5)
' Close Outlook applicationCall objOutlook.Quit
Set objOutlook = Nothing
End Sub