ArchonSoft
Programmer
I used them before but it was a longtime ago..
in my code I import outlook data that i'd like to put in my table "mail" using recordset to navigate from one record to another.
here is the code:
Private Sub btnImportMail_Click()
'variables
Dim strFrom As String
Dim strTo As String
Dim strAttachment As String
Dim bAttachment As Boolean
Dim rsMail As Recordset
Set olapp = CreateObject("Outlook.Application"
Set objNameSpace = olapp.GetNamespace("MAPI"
Set objFolder = objNameSpace.PickFolder
Me.RecordSource = "mail"
For Each mail In objFolder.Items
strFrom = mail.SenderName
strTo = mail.To
strCc = mail.Cc
strSubject = mail.Subject
For Each attachs In mail.Attachments
strAttachment = strAttachment & attachs.DisplayName & vbCrLf
Next attachs
rsMail.Fields("To"
= strTo
strAttachment = ""
rsMail.MoveNext
rsMail.AddNew
Next mail
End Sub
I know it's wrong, i'd like someone to help me correct it.
Thanks
in my code I import outlook data that i'd like to put in my table "mail" using recordset to navigate from one record to another.
here is the code:
Private Sub btnImportMail_Click()
'variables
Dim strFrom As String
Dim strTo As String
Dim strAttachment As String
Dim bAttachment As Boolean
Dim rsMail As Recordset
Set olapp = CreateObject("Outlook.Application"
Set objNameSpace = olapp.GetNamespace("MAPI"
Set objFolder = objNameSpace.PickFolder
Me.RecordSource = "mail"
For Each mail In objFolder.Items
strFrom = mail.SenderName
strTo = mail.To
strCc = mail.Cc
strSubject = mail.Subject
For Each attachs In mail.Attachments
strAttachment = strAttachment & attachs.DisplayName & vbCrLf
Next attachs
rsMail.Fields("To"
strAttachment = ""
rsMail.MoveNext
rsMail.AddNew
Next mail
End Sub
I know it's wrong, i'd like someone to help me correct it.
Thanks