S
schneider
Hi all,
In VBA, when trying this:
dim mi as Outlook.MailItem
set mi = Application.ActiveExplorer.Selection.Item(1) ' Here, Error 13
- Type mismatch occurs
I get a type mismatch error. If I declare mi as Object instead of
MailItem, the erroneous line works, but later when accessing
properties like mi.SenderName or functions like mi.SaveAs(), the
function crashes ("the function 'SaveAs' of object 'MailItem' failed.
Error Code: 8004010f"). When I examine the mi object, it says that it
is of type MailItem. mi.Class returns olMailItem (43), TypeName(mi)
returns "MailItem", etc.
Curiously, e.g. mi.Subject and mi.Class properties return correct
values, while mi.SenderName fails as mi.SaveAs() does.
Strangely, this does not happen for every Mail I select when running
the macro, and running the macro on another machine can but does not
always succeed.
The behaviour seems completely random. All machines are running
Windows XP SP2 with latest updates and Office 2003 SP2 accessing an
Exchange Server 2003.
Reading through this group there are some people who faced the same
problem, but since some properties work on the MailItem object, most
people didn't care about late binding and using the working
properties. In my case I have to use the SaveAs function which crashes
as described above.
Any hints/workarounds/cheats/whatever? Could it be an installation
issue? Reinstalling Office didn't help.
Thanks in advance.
Kind Regards,
Hannes
In VBA, when trying this:
dim mi as Outlook.MailItem
set mi = Application.ActiveExplorer.Selection.Item(1) ' Here, Error 13
- Type mismatch occurs
I get a type mismatch error. If I declare mi as Object instead of
MailItem, the erroneous line works, but later when accessing
properties like mi.SenderName or functions like mi.SaveAs(), the
function crashes ("the function 'SaveAs' of object 'MailItem' failed.
Error Code: 8004010f"). When I examine the mi object, it says that it
is of type MailItem. mi.Class returns olMailItem (43), TypeName(mi)
returns "MailItem", etc.
Curiously, e.g. mi.Subject and mi.Class properties return correct
values, while mi.SenderName fails as mi.SaveAs() does.
Strangely, this does not happen for every Mail I select when running
the macro, and running the macro on another machine can but does not
always succeed.
The behaviour seems completely random. All machines are running
Windows XP SP2 with latest updates and Office 2003 SP2 accessing an
Exchange Server 2003.
Reading through this group there are some people who faced the same
problem, but since some properties work on the MailItem object, most
people didn't care about late binding and using the working
properties. In my case I have to use the SaveAs function which crashes
as described above.
Any hints/workarounds/cheats/whatever? Could it be an installation
issue? Reinstalling Office didn't help.
Thanks in advance.
Kind Regards,
Hannes