D
Dale
Hello all,
I posted the folloing in Access modules newsgroup and received a suggestion
to post it in an Outlook newsgroup. Well, here goes.
I'm trying to write code in an Access module which is working with Outlook
email messages. It works fine on my machine. If I save it to the network
and then have him save it to his desktop to do testing, I get a "Type
Mismatch error". Here is the code. I'm not sure but I think
oFldr.Items.COUNT might have something to do with it because of the way
COUNT is in all caps.
Option Compare Database
Public Sub ProcessInbox()
Dim rs As New ADODB.Recordset
Dim strSQL As String
Dim oOutlook As Outlook.Application
Dim oNs As Outlook.NameSpace
Dim oFldr As Outlook.MAPIFolder
Dim oAttachments As Outlook.Attachments
Dim oAttachment As Outlook.Attachment
Dim iMsgCount As Integer
Dim oMessage As Outlook.MailItem
Dim SubFolder As Outlook.MAPIFolder
Dim iCtr As Long, iAttachCnt As Long
Dim sFileNames As String
Dim aFileNames() As String
Dim ConcatenatedFilename As String
Dim SenderString As String
Dim foundClientName As String
'get reference to inbox
Set oOutlook = New Outlook.Application
Set oNs = oOutlook.GetNamespace("MAPI")
Set oFldr = oNs.GetDefaultFolder(olFolderInbox)
Set SubFolder = oFldr.Folders("Efiles")
'Debug.Print "Total Items: "; oFldr.Items.Count
'Debug.Print "Total Unread items = " & oFldr.UnReadItemCount
MsgBox "Total Items: " & oFldr.Items.COUNT
MsgBox "Total Unread items = " & oFldr.UnReadItemCount
SenderString = "Sean LauterbachDale JonesJoe HoemeJohn HanzelRob HanksKeith
SchwartingDave ByrneAmy KalsowEd SorensenTom Bush"
For Each oMessage In oFldr.Items --------------------------THE ERROR
OCCURS HERE---------------!!!!!!!!!!!!!
With oMessage
'basic info about message
Debug.Print .To
Debug.Print .CC
Debug.Print .Subject
Debug.Print .Body
Hope someone can help.
Regards Dale
I posted the folloing in Access modules newsgroup and received a suggestion
to post it in an Outlook newsgroup. Well, here goes.
I'm trying to write code in an Access module which is working with Outlook
email messages. It works fine on my machine. If I save it to the network
and then have him save it to his desktop to do testing, I get a "Type
Mismatch error". Here is the code. I'm not sure but I think
oFldr.Items.COUNT might have something to do with it because of the way
COUNT is in all caps.
Option Compare Database
Public Sub ProcessInbox()
Dim rs As New ADODB.Recordset
Dim strSQL As String
Dim oOutlook As Outlook.Application
Dim oNs As Outlook.NameSpace
Dim oFldr As Outlook.MAPIFolder
Dim oAttachments As Outlook.Attachments
Dim oAttachment As Outlook.Attachment
Dim iMsgCount As Integer
Dim oMessage As Outlook.MailItem
Dim SubFolder As Outlook.MAPIFolder
Dim iCtr As Long, iAttachCnt As Long
Dim sFileNames As String
Dim aFileNames() As String
Dim ConcatenatedFilename As String
Dim SenderString As String
Dim foundClientName As String
'get reference to inbox
Set oOutlook = New Outlook.Application
Set oNs = oOutlook.GetNamespace("MAPI")
Set oFldr = oNs.GetDefaultFolder(olFolderInbox)
Set SubFolder = oFldr.Folders("Efiles")
'Debug.Print "Total Items: "; oFldr.Items.Count
'Debug.Print "Total Unread items = " & oFldr.UnReadItemCount
MsgBox "Total Items: " & oFldr.Items.COUNT
MsgBox "Total Unread items = " & oFldr.UnReadItemCount
SenderString = "Sean LauterbachDale JonesJoe HoemeJohn HanzelRob HanksKeith
SchwartingDave ByrneAmy KalsowEd SorensenTom Bush"
For Each oMessage In oFldr.Items --------------------------THE ERROR
OCCURS HERE---------------!!!!!!!!!!!!!
With oMessage
'basic info about message
Debug.Print .To
Debug.Print .CC
Debug.Print .Subject
Debug.Print .Body
Hope someone can help.
Regards Dale