Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > VBA - send email using CDO and Exchange


Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2009, 10:50 AM
pstirek pstirek is offline
Newcomer
 
Join Date: Jul 2009
Posts: 1
Default VBA - send email using CDO and Exchange


Hi all,
I have a problem with sending emails from VBA through remote Exchange server (in LAN). Previously I used remote SMTP server and everything was working fine, but now I changed few parameters to use Exchange instead and I'm facing the problem.

Here is my code (completely based on Microsoft refernence pages):

Code:
Dim Msg, Config
Set Msg = CreateObject("CDO.Message")
Set Config = CreateObject("CDO.Configuration")
Set Config = Msg.Configuration

Config("http://schemas.microsoft.com/cdo/configuration/sendusing") = 3
Config("http://schemas.microsoft.com/cdo/configuration/mailboxurl") = sMailboxURL
Config.Fields.Update

Msg.To = sTo
Msg.From = sFrom
Msg.Subject = sSubject
Msg.TextBody = sText

Msg.send

Set Msg = Nothing
Set Config = Nothing
The error occurs on line "Config.Fields.Update":
No.: 3749
Description: Fields update failed. For further information, examine the Status property of individual field objects.
Status of field 'Sendusing' = 262155

Does anyone know what is the problem? I can't find better detail of the error. Also I tried to use several forms in mailbox address but the result is still the same.

I would appreciate any help or hint.

Many thans,
regards,
Pavel
Reply With Quote
  #2  
Old 07-30-2009, 01:00 PM
emartinho emartinho is offline
Centurion
 
Join Date: Jan 2009
Location: Toronto, Ontario
Posts: 194
Default

Seems to me that the value you're putting in the Sendusing configuration parameter is invalid.
From what I could find on MSDN (http://msdn.microsoft.com/en-us/libr...EXCHG.10).aspx), there's only 2 options for SendUsing:
1 - SendUsingPickup
2 - SendUsingPort

Therefore the value 3 would cause an error. Whether that error is helpful or not...., well, we all know how Microsoft's errors "help" don't we?

Hope this helps.
-EM
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->