Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Problem create mail with Vista (http://www.outlookbanter.com/outlook-vba/51547-problem-create-mail-vista.html)

[email protected] June 29th 07 04:24 PM

Problem create mail with Vista
 
To automatically create a mail with an attachments I've always used
this code:

Dim allegati As Outlook.Attachment

Set OutLk = CreateObject("Outlook.Application")
Set email = OutLk.CreateItem(0)
With email
..Subject = "Subject"
..Body = "Body"
Set allegati = .Attachments.Add("c:\test.txt")
..Display
End With
Set email = Nothing
Set OutLk = Nothing

I use this code since 2-3 years ago, I have the references included in
the project and the only problem is that with Wista it doesn't work
and I get this error: "Object dosent support this property or method"
I use Outlook2003, if I try the same code with another PC with WinXP
or Win2000 everything works fine.

Thank you.


Sue Mosher [MVP-Outlook] June 29th 07 04:33 PM

Problem create mail with Vista
 
Where are you writing this code? Outlook VBA or somewhere else? What statement raises the error?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ups.com...
To automatically create a mail with an attachments I've always used
this code:

Dim allegati As Outlook.Attachment

Set OutLk = CreateObject("Outlook.Application")
Set email = OutLk.CreateItem(0)
With email
.Subject = "Subject"
.Body = "Body"
Set allegati = .Attachments.Add("c:\test.txt")
.Display
End With
Set email = Nothing
Set OutLk = Nothing

I use this code since 2-3 years ago, I have the references included in
the project and the only problem is that with Wista it doesn't work
and I get this error: "Object dosent support this property or method"
I use Outlook2003, if I try the same code with another PC with WinXP
or Win2000 everything works fine.

Thank you.


[email protected] June 29th 07 04:44 PM

Problem create mail with Vista
 
On 29 Giu, 16:33, "Sue Mosher [MVP-Outlook]"
wrote:
Where are you writing this code? Outlook VBA or somewhere else? What statement raises the error?


This code is written in VB6, the statement that raise the error is the
first: Set OutLk = CreateObject("Outlook.Application")

Sorry for the imprecision.


Sue Mosher [MVP-Outlook] June 29th 07 08:50 PM

Problem create mail with Vista
 
If you get an error from code statements like these:

Dim ol as New Outlook.Application

Set ol = CreateObject("Outlook.Application")

the cause may be an anti-virus program on your computer that has a feature to block Outlook scripting. If so, the solution is to turn off the script blocking feature. You may need to contact technical support for your anti-virus program to find out how to do that.

I've also seen reports that setting the server parameter can resolve this problem in some situations:

Set ol = CreateObject("Outlook.Applicaton", localhost)

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ups.com...
On 29 Giu, 16:33, "Sue Mosher [MVP-Outlook]"
wrote:
Where are you writing this code? Outlook VBA or somewhere else? What statement raises the error?


This code is written in VB6, the statement that raise the error is the
first: Set OutLk = CreateObject("Outlook.Application")

Sorry for the imprecision.



All times are GMT +1. The time now is 09:20 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com