Universal Document Converter
Product Overview
Download
Purchase
Tutorials
Developer Solutions
Support Service
About fCoder SIA


      Site search
   


      Popular conversions
PDF to JPG converter
Convert Word to PDF
Convert PDF to TIFF
Autocad to PDF converter
Convert Word to JPG
Powerpoint to PDF converter
Printing to PDF
Convert Excel to PDF
Convert DJVU to PDF
Convert Web Page to PDF

      Video tutorials
Show tutorial



Main page>Developer Solutions>Examples>Visual Basic 6>Outlook Messages to TIFF

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 Sub
Private Sub PrintOutlookMsgToTIFF(ByVal strFilePath As String)
  Const olDiscard = 1 ' = Outlook.OlInspectorClose.olDiscard
  
  Dim objUDC As IUDC
  Dim itfPrinter As IUDCPrinter
  Dim itfProfile As IProfile
  Dim objOutlook As Object
  Dim itfMsg As Object
  
  Set 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-server
  Set objOutlook = CreateObject("Outlook.Application")
 ' Open Outlook MSG file
  Set itfMsg = objOutlook.CreateItemFromTemplate(strFilePath)
 ' And print it on the default printer
  Call itfMsg.PrintOut
 ' Close opened file
  itfMsg.Close (olDiscard)
 ' Wait until Outlook finished printing process
  WaitSomeTime (5)
 ' Close Outlook application
  Call objOutlook.Quit
  Set objOutlook = Nothing
 End Sub


© fCoder SIA About fCoder SIA | Privacy Policy | Site Map