oft documents to Access

  • Thread starter Thread starter michael.thompson
  • Start date Start date
M

michael.thompson

I have many custom .oft documents and I need to import their data into
Access.

I have spent several days and tried code samples from several of the
forums but nothing works. The samples seem to be for tasks but I have
seperate documents.

I can link to the documents but can not see any of the custom fields.
With VBA, I can not see any of the fields.

All of the code I find is for tasks but I have seperate documents.

I see two methods at this time.
Option 1
Open the documents and read the fields

Option 2
Open each document and save it as a text file. Create a VBA function
to read the text file then import the data into the access table.

I would prefer Option 1 if anybody has any sample code on how to open
the oft documents and read the custom fields.
 
You can use the Application.CreateItemFromTemplate method to create a copy of each item as an Outlook object whose UserProperties collection you can work with in code.

Note that the .oft format is intended for storing copies of forms, not data items.
 
I have tried several samples from the forums bun none of them expose
the custom fields.

Do you have a some sample code that I can look at. Here is what I have
and it gives the error message number 91 -Object VAriable or With
Block Variable Not Set on " fld = itm.UserProperties("Subject:")".

Sub OFTDocs()
Dim objOutlook As New Outlook.Application
Dim PublicFolder As MAPIFolder
Dim OldTaskItems As Items
Dim itm
Dim fld As String

Set PublicFolder = objOutlook.GetNamespace("MAPI").Folders("Mailbox
- Thompson, Mike").Folders("OFT Requests")
Set OldTaskItems = PublicFolder.Items.Restrict("[Subject] > ''")

For Each itm In OldTaskItems
fld = itm.UserProperties("Subject:")
Next

End Sub
 
Sample code for what? Because you didn't quote any of the earlier discussion in your reply, we don't know what code you're looking for.

Did you actually create a custom property named "Subject:"? If so, why, since Outlook already has a built-in Subject property?
 
Back
Top