Hi there,
I am developing an application in Access 2003 and need to send an email through Outlook based on the information entered on the form. Everything works except that the email is being sent as plain text so none of the formatting is retained. Also, I can't figure out how to get Outlook to pick up the autosignature.
The script I'm using is: -
Private Sub cmdSendEmail_Click()
-
On Error GoTo StartError
-
Dim stLinkCriteria As String
-
Dim stSubject As String
-
Dim sthtmlBody As String
-
-
Dim objItem As Object
-
Dim objInsp As Outlook.Inspector
-
' requires a project reference to the
-
' Microsoft Word library
-
Dim objDoc As Word.Document
-
Dim objSel As Word.Selection
-
Dim objCB As Office.CommandBar
-
Dim objCBP As Office.CommandBarPopup
-
Dim objCBB As Office.CommandBarButton
-
Dim colCBControls As Office.CommandBarControls
-
-
'insert autosig
-
Set objInsp = Application.ActiveInspector
-
If Not objInsp Is Nothing Then
-
Set objItem = objInsp.CurrentItem
-
If objItem.Class = olMail Then ' editor is WordMail
-
If objInsp.EditorType = olEditorWord Then
-
' next statement will trigger security prompt
-
' in Outlook 2002 SP3
-
Set objDoc = objInsp.WordEditor
-
Set objSel = objDoc.Application.Selection
-
If objDoc.Bookmarks("_MailAutoSig") Is Nothing Then
-
objDoc.Bookmarks.Add Range:=objSel.Range, name:="_MailAutoSig"
-
End If
-
objSel.GoTo What:=wdGoToBookmark, name:="_MailAutoSig"
-
Set objCB = objDoc.CommandBars("AutoSignature Popup")
-
If Not objCB Is Nothing Then
-
Set colCBControls = objCB.Controls
-
End If
-
Else ' editor is not WordMail
-
get the Insert | Signature submenu
-
-
Set objCBP = Application.ActiveInspector.CommandBars.FindControl(, 31145)
-
If Not objCBP Is Nothing Then
-
Set colCBControls = objCBP.Controls
-
End If
-
End If
-
End If
-
If Not colCBControls Is Nothing Then
-
For Each objCBB In colCBControls
-
If objCBB.Caption = strSigName Then
-
objCBB.Execute ' **** see remarks
-
Exit For
-
End If
-
End If
-
End If
-
-
If IsNull([ContactMode]) Or ([ContactMode]) = "" Then
-
MsgBox "No email is specified."
-
ElseIf IsNull([Purpose]) Or ([Purpose]) = "" Then
-
MsgBox "There is no subject line."
-
ElseIf IsNull([Action]) Or ([Action]) = "" Then
-
MsgBox "The email body is empty."
-
-
Exit Sub
-
-
Else
-
stLinkCriteria = Me![ContactMode]
-
stSubject = Me![Purpose]
-
sthtmlBody = Me![Action]
-
DoCmd.SendObject acSendNoObject, , , stLinkCriteria, , , stSubject, sthtmlBody
-
-
End If
-
-
Set objInsp = Nothing
-
Set objItem = Nothing
-
Set objDoc = Nothing
-
Set objSel = Nothing
-
Set objCB = Nothing
-
Set objCBB = Nothing
-
-
StartError:
-
MsgBox "No email was sent."
-
Exit Sub
-
End Sub
1 2599 MMcCarthy 14,534
Recognized Expert Moderator MVP
This question is being moved to the Access forum.
ADMIN
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jared |
last post by:
Hello people,
I've had major difficulties finding the right Java technology that can
be used to make an e-mail applet program. I'm trying to build an
applet that would be similar, but much simpler, than Hotmail or
Webmail. I've been told by our system administrator that I can't
access our SMTP and POP3 servers directly. If I could use SMTP or
POP3, this problem would be trivial, I think. But instead, I'm forced
to rely on the HTTP...
|
by: Del |
last post by:
I have two question on sending email messages from MS Access (Versio
2000, 2002, and 2003). I have a form with a command button to send an
email message, the code behide the button is as follows;
=============================================================================
Dim strRecipient As String
Dim strSubject As String
Dim strMessageBody As String
|
by: Tom Dauria |
last post by:
I have a Access database application that sends email through Outlook.
A few years ago we started having a problem where it would ask for
each and every email being sent whether you want to give access to
your email addresses in outlook and then something about sending mail
on your behalf.
Anyway we purchased software called Outlook Redemption. The thing is
we are having some problem with that software now and I had heard that
with...
|
by: melsink |
last post by:
I am trying find the best method to send email from my a contact access
database. I would need to send group emails and save the transaction in
access (is. time/date, subject of email and who the emails went to). Using
MS Outlook 2003, I would like access to populate the to and cc fields in
outlook.
Thanks
Mel
|
by: acewood1 |
last post by:
I've done some searching in the archives but can't seem to find an easy
answer as to how to send a Groupwise email through Access 2003. I just
need to open a new email and populate the "To:" line with the email
address on a form. In Access 97 this simple line on a command button
got the job done.
DoCmd.SendObject , "", "", Me.txtEmail, "", "", "", "", True, ""
I've been to Dev Ashish's site and saw the code written by Dimitri...
| |
by: Dmitry Davletbaev |
last post by:
Hi!
I have an ASP page with script in it. This script makes connection to Access
database (JET 4.0) and retrieves data. Some time later this page became
unavailable with following error:
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
....
Technical Information (for support personnel):
Error Type:
|
by: dkao99 |
last post by:
I have problem with the following code when OUTLOOK.EXE process in on.
First, I make sure no outlook is running. The "GetObject" will set the oOApp to outlook and the code works fine. One problem is that if I comment out the ".Display" the "Quit" will not stop the outlook process.
Second, if the outlook process is on, the "GetObject" and "CreateObject" failed, "Outlook.Application.CreateItem(olMailItem)" also failed.
I don't know why...
|
by: abdoelmasry |
last post by:
Hi men
i have big problem with microsoft exchange server 2003
i installed exchange server as main mail server to use it on in company
i have static real ip address
im sending and receiving mails good but
|
by: teddysnips |
last post by:
I'm having trouble adding Access 2003 databases to Sourcesafe. I go
to Tools, Sourcesafe, Add Database to Sourcesafe... at which point a
message box appears saying "This database must be closed before you
add it to Sourcesafe. Do you want Microsoft Access to close this
database?" I click "Yes", and it displays the Sourcesafe Login
screen. I log in, and select a location to add the project. And then
nothing happens. Zilch. Nada. ...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |