A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Using VB to Create E-mails



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old July 31st 08, 02:50 PM posted to microsoft.public.outlook.program_vba
McKilty
external usenet poster
 
Posts: 11
Default Using VB to Create E-mails

Oops. It's been a while since I've programmed anything, so I'm very
rusty. This was actually written by a co-worker who has since left.


Ok... I've been working on it and it appears that one lone e-mail was
screwing it up. When that e-mail was removed, it worked fine. The e-
mail was there and there appeared to be nothing wrong with it.


Thanks




On Jul 30, 5:28 pm, "Michael Bauer [MVP - Outlook]"
wrote:
That's not the Redemption but CDO library. Have you considered that maybe
the message doesn't exist anymore?

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: http://www.vboffice.net/product.html?pub=6〈=en

Am Wed, 30 Jul 2008 14:05:43 -0700 (PDT) schrieb McKilty:

Here's a strange problem that recently popped up. I have a program
that creates an e-mail in Office 2003 via Outlook Redemption. This
program has worked for months, but suddenly it stopped working.


The applicable code is:


Dim olOutlook As Outlook.Application
Dim nsNameSpace As Outlook.NameSpace
Dim oSession As MAPI.Session
Dim mFolder
Dim itmEmails As Items
Dim iCount, iEmail, iLate, iSub As Double
Dim oItem
Dim sEntry, sStore, sSQLText, sBCC, sCC, s1Day, s2Day, sGT2Day, sBody
As String
Dim oMessage As MAPI.Message
Dim NewMail
Dim SafeMail


Set olOutlook = New Outlook.Application
Set nsNameSpace = olOutlook.GetNamespace("MAPI")
Set oSession = CreateObject("MAPI.Session")


oSession.Logon "DS", , False, False


Set mFolder = nsNameSpace.Folders("Mailbox - Daily
Summary").Folders("DailySummaries")
Set itmEmails = mFolder.Items
Set itmEmails = itmEmails.Restrict("[ReceivedTime] '" & Format(gDate
& " 11:59 PM", "MM/dd/yy hh:mm AMPM") & "'")


iCount = itmEmails.Count


For iEmail = 1 To iCount
Set oItem = itmEmails.Item(iCount - iEmail + 1)
sEntry = oItem.EntryID
sStore = oItem.Parent.StoreID


Set oMessage = oSession.GetMessage(sEntry, sStore)


Set NewMail = itmEmails.Item(iCount - iEmail + 1)
Set SafeMail = New Redemption.SafeMailItem
SafeMail.Item = NewMail


[SNIP]


The code runs fine on my computer, but on the intended server (where
it used to run fine) I get an error when it runs the line:


Set oMessage = oSession.GetMessage(sEntry, sStore)


The error message is:


Error Number -2147467259
The client operation failed. [Microsoft Exchange Server Information
Store - [E_FAIL(80004005)]]


Any ideas what could be wrong? I think the code is fine, so what
could have happened on the server?


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create distribution list from lots of e-mails? SWFRPC Worker Outlook - Using Contacts 3 March 23rd 07 09:48 PM
Can's able to recieve mails but sending mails About Outlook Configuration Outlook - General Queries 4 July 5th 06 06:00 PM
How can I create a macro with an icon to permanetly delete mails Ralph C Outlook and VBA 1 June 20th 06 05:27 AM
Create a macro to send e-mails to microsoft image writer Scott Outlook and VBA 1 June 9th 06 06:37 PM
Can't create new e-mails HBK Outlook - General Queries 4 March 3rd 06 01:46 PM


All times are GMT +1. The time now is 04:09 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-2025 Outlook Banter.
The comments are property of their posters.