On May 19, 12:01*am, Salad <o...@vinegar.comwrote:
In A2003 one can create a linked table using
File/GetExternalData/Link/Exchange(). *It's a nice feature but by and
large fairly useless if I am reading the table structure correctly.
The From & SenderName columns may contain data like joeb...@test.com or
it may simply be Joe Blow. *The HasAttachments column may be true or
false but accessing the attachments isn't available if the value is true.
Is there any way this linked table could be of use in getting the email
addresses as well as the name of the sender as well as associating or
getting the attachments? *Or can one access the email via automation
with the data contained in the linked table?
I've been working on a similar problem - I have a bunch of attachments
stored in messages in a public folder that needed to be associated
with an Access database.
The quickest way I found was to attach code to Outlook to interogate
the selected folder, then walk through the messages looking for
attachments and, if found, copy them to a directory whilst copying
info about the message and file name (I had to rename a number of
attachments because their original name was form.pdf) to a text file.
Based on the time contraints and what I didn't originally understand
about the project I ended up with quite a kludge. Here's the first
part (just before it gets reall ugly)"
Public Sub SaveAllAttachments()
'Note, this assumes you are in the a folder with e-mail messages
when you run it.
'It does not have to be the inbox, simply any folder with e-mail
messages
'On Error GoTo ErrorHandler
Dim App As New Outlook.Application
Dim Exp As Outlook.Explorer
Dim Sel As Outlook.Items
Dim sSub As String
Dim sFile As String
Dim att As Attachment
Dim attName As String
Dim AttachmentCnt As Integer
Dim AttTotal As Integer
Dim MsgTotal As Integer
Dim outputDir As String
Dim outputFile As String
Dim fileExists As Boolean
Dim cnt As Integer
Dim lf As Integer
Dim iNS As Integer
'Requires reference to Microsoft Scripting Runtime (SCRRUN.DLL)
Dim fso As FileSystemObject
Set Exp = App.ActiveExplorer
Set Sel = Exp.CurrentFolder.Items
Set fso = New FileSystemObject
lf = FreeFile()
outputDir = "S:\public\project_folder\Forms\"
'Loop thru each selected item in the inbox
Open outputDir & "file_list.txt" For Output As #lf
Write #lf, "Subject", "Attachment", "FileName", "Status"
For cnt = 1 To Sel.Count
'If the e-mail has attachments...
If Sel.Item(cnt).Attachments.Count 0 Then
### end sample ####
The original code I modified is at
http://arcanecode.files.wordpress.co...tachments3.txt
If I was smarter I imagine that I could do all of this from within
Access and move the files one at a time.
I too am interested in hints and guidance on how to do that.
Tim Mills-Groninger