Hi All,
I've been using this function which I got from here for some time now
in two of my AccessXP multiusers applications and it has worked
without issue until lately it has stopped functioning on several user
pc's and I don't know why. I've asked our PC Services group what they
changed on the pc's that this does not work on and they say 'nothing'.
Well something has changed cause this did work at one time.
When I step thru it in debug mode it errors on the very first line of
code - Set MapiSession = CreateObject("M api.Session")
it display an error number 2147221934 which I could not find in
looking thru the Mapi error messages.
Anyone know what might be happening???
thanks
bobh.
Public Function SendMAPIMessage (strSubj As String, strMesTxt As
String, strAttchFile As String, strFrom As String)
On Error GoTo MAPITrap
' This procedure sets an object variable to the MAPI Session Object
' using the CreateObject() function. Then, it logs on to the session
' using a predefined profile. Once logged on, the procedure creates
' a new message and adds it to the Messages collection of the User 's
' OutBox. Then, it creates two recipients (one on the TO: line and
' one on the CC: line) and adds both to the Recipients collection
' of the message. Next, it resolves the names of all recipients.
' Then, it attaches a sample file before filling in the Subject,
' Text, and Importance attributes of the message.
'--------------------------------------------------------------------
Const mapiNormal = 3
Const mapiHigh = 2
Dim MapiSession As Object, MapiMessage As Object
Dim MapiRecipient As Object, MapiAttachment As Object
Dim errObj As Long
Dim errMsg
' Create the MAPI Session.
Set MapiSession = CreateObject("M api.Session")
' Log on to the session. If the ProfileName argument is omitted,
' Microsoft Exchange prompts you for the profile to use. If the
' profile name is incorrect, you will receive a runtime error.
MapiSession.Log on profilename:="N ovell Default Settings"
' Add a message to the Outbox.
Set MapiMessage = MapiSession.Out box.Messages.Ad d
' Add the recipients of the message. Note, each recipient must be
' added separately to the Recipients collection of the Message object.
With MapiMessage
'Set MapiRecipient = MapiMessage.Rec ipients.Add
'MapiRecipient. Name = "so******@compa ny.com"
'Set MapiRecipient = MapiMessage.Rec ipients.Add
'MapiRecipient. Name = "so*****@here.c om"
'Attach a file to the message.
Set MapiAttachment = MapiMessage.Att achments.Add
With MapiAttachment
.Name = strAttchFile
.Position = 2880
.Type = 1
.ReadFromFile FileName:=strFr om
End With
'Assign the text, subject, and importance of the message.
.Subject = strSubj
.Text = strMesTxt
.Importance = mapiHigh
'View the message in Microsoft Exchange before sending.
'Set the ShowDialog argument to False if you want to send the
'message without viewing it in Microsoft Exchange.
.Send showdialog:=Tru e
End With
Set MapiSession = Nothing ' Clear the object variable.
MAPIExit:
Exit Function
MAPITrap:
errObj = Err - vbObjectError ' Strip out the OLE automation
error.
Select Case errObj
Case 275 ' User cancelled sending of
message.
Resume MAPIExit
Case Else
errMsg = MsgBox("Error " & errObj & " was returned.")
Resume MAPIExit
End Select
End Function 1 2851
On 10 May 2007 12:47:44 -0700, bobh <vu******@isp.c omwrote:
I sometimes get errors on that line if CDO is not installed: http://support.microsoft.com/default...b;en-us;171440
-Tom.
>Hi All, I've been using this function which I got from here for some time now in two of my AccessXP multiusers applications and it has worked without issue until lately it has stopped functioning on several user pc's and I don't know why. I've asked our PC Services group what they changed on the pc's that this does not work on and they say 'nothing'. Well something has changed cause this did work at one time.
When I step thru it in debug mode it errors on the very first line of code - Set MapiSession = CreateObject("M api.Session") it display an error number 2147221934 which I could not find in looking thru the Mapi error messages.
Anyone know what might be happening??? thanks bobh.
Public Function SendMAPIMessage (strSubj As String, strMesTxt As String, strAttchFile As String, strFrom As String) On Error GoTo MAPITrap
' This procedure sets an object variable to the MAPI Session Object ' using the CreateObject() function. Then, it logs on to the session ' using a predefined profile. Once logged on, the procedure creates ' a new message and adds it to the Messages collection of the User 's ' OutBox. Then, it creates two recipients (one on the TO: line and ' one on the CC: line) and adds both to the Recipients collection ' of the message. Next, it resolves the names of all recipients. ' Then, it attaches a sample file before filling in the Subject, ' Text, and Importance attributes of the message. '--------------------------------------------------------------------
Const mapiNormal = 3
Const mapiHigh = 2
Dim MapiSession As Object, MapiMessage As Object
Dim MapiRecipient As Object, MapiAttachment As Object
Dim errObj As Long
Dim errMsg ' Create the MAPI Session.
Set MapiSession = CreateObject("M api.Session")
<clip> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Siegfried Heintze |
last post by:
Does the Outlook API supersede MAPI?
If I implement a SPAM filter using MAPI to automatically delete messages
from the message store, will other clients like Eudora benefit?
If I implement a SPAM filter using Outlook to automatically delete messages
from the message store, will other clients like Eudora benefit?
Thanks,
Siegfried
|
by: Kurt |
last post by:
Hi
I am using CDO 1.21 from C# in order to iterate through the entries in a users outlook address book (as OOM was too slow). Basically I take the Name field from each "message" and insert it into a ListBox. I shall paste my code at the end, and describe my problem first
If I call my MAPI.Sessions Logoff method when I have finished using it, then this method takes between 1 and 5 minutes to execute, but after that everything is fine
If...
|
by: Ottar |
last post by:
I've made a program sorting incomming mail in public folder.
The function runs every minute by using the form.timer event.
In Access XP it runs for weeks, no problem. Access 2003 runs the same
code for 6 hours and stops.
I've found the problem to be the Set MySession =
CreateObject("MAPI.Session")
|
by: Ottar |
last post by:
Error: 80040108 after 380 CreateObject("MAPI.Session")
Function MAPI_Test2()
Dim i As Integer
Dim MySession As MAPI.Session
i = 0
While (i < 2000)
Set MySession = CreateObject("MAPI.Session")
Debug.Print i
|
by: bobdydd |
last post by:
Hi Everybody
Can anyone help with this mindbender
We are writing an application that uses a VB built DLL to send emails
using CDO 1.21.
Whether we use the VB DLL or code the CDO stuff direct into Access
makes no difference.
| |
by: Rico |
last post by:
Hello,
I'm using formmail.asp which is an emailing utility. Basically, the user
fills out a request page, clicks "Submit" and the page posts to formmail.asp
which emails the user information.
I'm running IIS5 on a Win2k server box and recently ran the Windows Updates
(the last time I do that). Anyway, that emailing form doesn't work now on
any of the sites I host. Any ideas?
|
by: Steve Le Monnier |
last post by:
Can anybody help with the following: I have some old VB6 code that loops
through my inbox looking for emails with attachments and then save them to
the hard drive. The code is very simplistic so I thought it would be dead
easy to migrate it to C#, however it is proving more difficult than I first
thought.
The VB code is as follows:
Set oSession = CreateObject("MAPI.Session")
oSession.Logon("Outlook", , False)
|
by: GayathriP |
last post by:
This article discusses about how can we access the inbox through MAPI using C# .NET. It also discusses about how to store the attachment in the local directory, how to create a folder in the inbox
Need to add the reference Microsoft CDO 1.21 Library to the project
//Declarations
MAPI.Message objMsg, objMsg_Arch;
MAPI.Messages objMsgs;
MAPI.Attachment objAttach;
MAPI.Attachments objAttachments;
|
by: squrel |
last post by:
Hi everyone..
i need ur help once more time.... i have a form called reminder..in tht form i have:
txtid, txtcaseid, txtreminder, cmbremindby(system or user), txtremindto, dtpreminddt, MAPISession1, MAPIMessages1, cmdReminder
in this case i have to set some fix reminder and fix date for every month tht automatically send by the system to some particular people...
i dont knw anything abt mapi control and have never used tht...
got some...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |