Hi all. I've run into a strange and annoying problem. I am really
stumped here - I hope someone might suggest where I might be going
wrong... What I am doign is really simple, as is the error itself. I am
looping through messages in an exchange a/c using outlook 2000 object
model. When I try to get a handle to an individual message with .GetLast
I get a Type Mismatch Error. This problem only occurs on the machine I am
running it on (Windows 2000 Server with Exchange), not the machine I
developed it on....
This code is pretty much out of samples I have seen on the web and works
on my local machine... It works on my local machine (Windows 2000 Server,
Office 2000) but does not on the target machine (The same except +
Exchange Server)
Dim o As Outlook.Application
Dim ns As Outlook.NameSpace
Dim f As MAPIFolder
Dim strExtractedEmail As String
Dim msgs As Outlook.Items
Dim msg As MailItem
Set ns = Application.GetNamespace("MAPI")
Set o = CreateObject("Outlook.Application")
Set ns = o.GetNamespace("MAPI")
Set f = ns.Folders("foo")
Set msgs = f.Items
'//At this stage, the msgs object is OK,
'//I can access all properties no problem
Do While msgs.Count > 0
Set msg = msgs.GetLast
'//This gives me a Type Mismatch Error,
'//as if I am using the wrong object...
Debug.Print msg.subject
msg.Delete
Loop
I tried Dimming msg as Variant - This works, but I don't seem to have
access to all the normal properties of the msg object, for example, I read
the .subject property when using the variant, but not the .body!
-Fergal
_________________________________________________________________
List posting FAQ: http://www.swinc.com/resource/exch_faq.htm
Archives: http://www.swynk.com/sitesearch/search.asp
To unsubscribe: mailto:[EMAIL PROTECTED]
Exchange List admin: [EMAIL PROTECTED]