Sar1973
asked on
Outlook folders export: how to pick the fields (properties) name with VBA.
I am looking for a VBA code that allows me to list every field name of my Outlook messages.
In other words, I want to know the name of the mapped fields I usually can get with the Outlook export action to .xls file; I would then use them in MS Access functions like below.
Thank you.
In other words, I want to know the name of the mapped fields I usually can get with the Outlook export action to .xls file; I would then use them in MS Access functions like below.
Thank you.
Dim olkItems As Object, olkItem As Object
....
For Each olkItem In olkItems
...=olkItem.Field1 (es. Name)
...=olkItem.Field2 (es. Subject)
...=....
Next olkItem
ASKER
If I launch this code, I get some errors: outMessage is not delcared, so I get "an object is necessary"
If I declare it as object, I get "With variabloe not set"
If I declare it as object, I get "With variabloe not set"
outMessage is my variable that is either an Object or Outlook.MailItem
I think with late binding, dimming the variable as Object, then you will need to use the For cnt looping
Cheers, Andrew
I think with late binding, dimming the variable as Object, then you will need to use the For cnt looping
Cheers, Andrew
ASKER
Then, could you please provide a code that works and gives me every field name?
Have you got the code that give you an Outlook message, either the message you have created or the message you have found. If so can you please provide what you have.
Cheers, Andrew
Cheers, Andrew
ASKER
I got it: if you use this code you get a string with every property and field name.
I gues it would work also if you pick a single item of an Outlook folder instead of creating a new item/message and looking what it's made of.
I gues it would work also if you pick a single item of an Outlook folder instead of creating a new item/message and looking what it's made of.
Dim olkName As String
Dim oip As Outlook.ItemProperty
Dim oips As Outlook.ItemProperties
Dim olApp As Object
Dim oItem As Object
Set olApp = CreateObject("Outlook.application")
Set oItem = olApp.CreateItem(0)
Set oips = oItem.ItemProperties
For Each oip In oips
olkName = olkName & ", " & oip.Name
Next
Me.Pinco = olkName
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cheers, Andrew
Open in new window