Question : Using VBA to read inbox of non-default mailbox

We use Exchange 2003 / Outlook 2000.
All of our engineers have an additional mailbox open called "sptmail"

The script below nicely reads the default inbox and adds messages that don't exist in the Access table.

I would like it to read the sptmail mailbox's inbox instead of the default user's.
I think the pieces are here to do it, I just haven't been able to put them all together.

Dim rst As DAO.Recordset
Dim olApp As OutLook.Application
Dim Inbox As OutLook.MAPIFolder
Dim InboxItems As OutLook.Items
Dim Mailobject As Object
Dim db As DAO.Database

Set db = CurrentDb

Set olApp = CreateObject("Outlook.Application")
Set Inbox = olApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)

Set Rst = CurrentDb.OpenRecordset("tbl_OutlookTemp")

Set InboxItems = Inbox.Items

For Each Mailobject In InboxItems ' Loop through inbox

    Do Until Rst.EOF ' Loop through database
            If Rst!ID = Mailobject.EntryID Or IsNull(Rst!ID) Then GoTo skip ' Found matching ID or table has null ID
            Rst.MoveNext
    Loop ' End loop through database

                   ' No matching message ID, add to table
                    Rst.AddNew ' Add to database
                    If Mailobject.Subject = "" Then
                   ' Add subject as NONE instead of blank            
                        Rst!Subject = "None"
                    Else
                           Rst!Subject = Mailobject.Subject
                    End If
               
                Rst!FROM = "From"
                Rst!To = Mailobject.To
                Rst!Body = Mailobject.Body
                Rst!Received = Mailobject.ReceivedTime
                Rst!ID = Mailobject.EntryID
                Rst.Update
skip:
Next ' End loop through inbox

Set olApp = Nothing
Set Inbox = Nothing
Set InboxItems = Nothing
Set Mailobject = Nothing
Rst.Close
Set Rst = Nothing
DoCmd.Requery

End Sub

Answer : Using VBA to read inbox of non-default mailbox

DOS cannot use any Windows drivers. All DOS programs have built-in drivers for all the printers they can support. As PDF was not developed until long after DOS had been replaced by Windows, there are no DOS applications that create PDFs.

About all I can think of is to use a PCL to PDF converter. Then get the DOS app to print to file (assuming it can even do that) and the converter can pick up up the file and create the PDF. There are many PCL converters available, for example:

http://www.verypdf.com/pcltools/index.html

If your DOS output consists of text only, without any printer codes, they also have a free converter:

http://www.verypdf.com/txt2pdf/index.htm

Both will run from a command line, so you could write a batch program that keeps looking for a PCL file. If it finds one, convert it and delete the original.

If your DOS app can only print to a physical port (e.g. LPT1) there are programs that can capture the output and redirect it to a file. Then you can use VeryPDF on that file. For example:

http://www.printfil.com/manualen/c7.htm
Random Solutions  
 
programming4us programming4us