Wanted Outlook VBA field names (1 Viewer)

tonez90

Registered User.
Local time
Today, 11:47
Joined
Sep 18, 2008
Messages
42
I am developing a scheduler program which will also read emails from MS Outlook. I am after a list of field names (such as SentOn, SenderName, To, CC, Subject, Body, Unread etc)

I have only found a few like the ones listed above. Does anyone have a list of the actual field names I can use for outlook email.

cheers
Tonez

If anyone is intested here is the code I use to just read the inbox only:
-----------------------------------------------------------------------

Public Function Scan_Inbox_only()
On Error Resume Next
Dim att_i As Integer
Dim rs1 As Recordset
Dim rsBOM As DAO.Recordset
Dim tmpstr As String
Dim OlApp As Outlook.Application
Dim Inbox As Outlook.MAPIFolder
Dim InboxItems As Outlook.items
Dim Item As Object
Dim Mailobject As Object
Dim item_att As Attachment
Set OlApp = CreateObject("Outlook.Application")
Set Inbox = OlApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox)
Set InboxItems = Inbox.items
'delete all existing email information
currentdb.Execute "DELETE * FROM UsysRef_Tmp_Email", dbFailOnError
currentdb.Close

If Inbox.items.Count = 0 Then
MsgBox "There are no messages in your Inbox.", vbInformation, "Nothing Found"
Exit Function
End If
Dim filename As String
'Now to process the inbox of the person using this database
' Check each message for attachments
For Each Mailobject In InboxItems
filename = ""
att_i = 0
'If InStr(1, Mailobject.Subject, "WAT") > 0 Then
For Each item_att In Mailobject.attachments
filename = filename & "; " & item_att.filename
att_i = att_i + 1
Next item_att
Set rs1 = currentdb.OpenRecordset("UsysRef_Tmp_Email", dbOpenDynaset)
rs1.AddNew
rs1![datesent] = Mailobject.SentOn
rs1![whosent] = Mailobject.SenderName
rs1![dateRecieved] = Mailobject.Received
rs1![Read] = iif((Mailobject.UnRead = True), "UnRead", "Read")
rs1![To] = Mailobject.To
rs1![CC] = Mailobject.CC
rs1![Subject] = Mailobject.Subject
rs1![Body] = Mailobject.Body
rs1![num_attachment] = att_i
rs1![name_attachment] = iif(Left(filename, 1) = ";", Right(filename, Len(filename) - 2), filename)
rs1.update
rs1.Close
Set rs1 = Nothing
Next
currentdb.Close
MsgBox ("Scan of Inbox completed")
End Function
 

ajetrumpet

Banned
Local time
Yesterday, 21:17
Joined
Jun 22, 2007
Messages
5,638
open outlook, go to the VB library and look at the all of the subobjects of the MAILITEM object. that will give you all you need to know. you're looking for PROPERTIES of the mail item
 

SharonD

New member
Local time
Yesterday, 19:17
Joined
Sep 30, 2009
Messages
2
For some reason, I cannot see any detail when I view the Outlook VBA properties to see all the object item names. I just need to know the field name (object item name) for the field "FROM." I have VBA code that automates the sending of an Outlook email, and want to change the "From" address to use a group email box. I tried "objitem.from" and that didn't work. HELP! THANK YOU!
 

darbid

Registered User.
Local time
Today, 04:17
Joined
Jun 26, 2008
Messages
1,428
I am very rusty with Outlook and thus I do not recall how you change your FROM address. How would you do this manually?

With respect to the VBA object browser you should have as your object in the left column "mailitem" then all the properties and methods of the mailitem object will appear. For example to answer your question I saw some "sender" properties, but they are read only which means it is for emails that have been sent.
 

SharonD

New member
Local time
Yesterday, 19:17
Joined
Sep 30, 2009
Messages
2
I've found a solution! I am running this code within Excel, using it to launch automated emails. The statement I used is:

objitem.sentonbehalfofname = "<email address>"

works like a charm! :]

BTW, The FROM box is like the BCC box in that you can choose to hide or unhide it. When you open a blank email to compose, there is an "Options" dropdown box. You can click "From" to show this field.

Of course, you need proper security to send on behalf of another box.

Thanks
 

Users who are viewing this thread

Top Bottom