473,769 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Autosignature when sending email from Access 2003

1 New Member
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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSendEmail_Click()
  2.  On Error GoTo StartError
  3.  Dim stLinkCriteria As String
  4.     Dim stSubject As String
  5.     Dim sthtmlBody As String
  6.  
  7.     Dim objItem As Object
  8.     Dim objInsp As Outlook.Inspector
  9.     ' requires a project reference to the
  10.     ' Microsoft Word library
  11.     Dim objDoc As Word.Document
  12.     Dim objSel As Word.Selection
  13.     Dim objCB As Office.CommandBar
  14.     Dim objCBP As Office.CommandBarPopup
  15.     Dim objCBB As Office.CommandBarButton
  16.     Dim colCBControls As Office.CommandBarControls
  17.  
  18. 'insert autosig
  19. Set objInsp = Application.ActiveInspector
  20.     If Not objInsp Is Nothing Then
  21.         Set objItem = objInsp.CurrentItem
  22.         If objItem.Class = olMail Then  ' editor is WordMail
  23.             If objInsp.EditorType = olEditorWord Then
  24.                 ' next statement will trigger security prompt
  25.                 ' in Outlook 2002 SP3
  26.                 Set objDoc = objInsp.WordEditor
  27.                 Set objSel = objDoc.Application.Selection
  28.                 If objDoc.Bookmarks("_MailAutoSig") Is Nothing Then
  29.                     objDoc.Bookmarks.Add Range:=objSel.Range, name:="_MailAutoSig"
  30.                 End If
  31.                 objSel.GoTo What:=wdGoToBookmark, name:="_MailAutoSig"
  32.                 Set objCB = objDoc.CommandBars("AutoSignature Popup")
  33.                 If Not objCB Is Nothing Then
  34.                     Set colCBControls = objCB.Controls
  35.                 End If
  36.            Else ' editor is not WordMail
  37.                 get the Insert | Signature submenu
  38.  
  39.                Set objCBP = Application.ActiveInspector.CommandBars.FindControl(, 31145)
  40.                If Not objCBP Is Nothing Then
  41.                     Set colCBControls = objCBP.Controls
  42.                 End If
  43.             End If
  44.        End If
  45.        If Not colCBControls Is Nothing Then
  46.            For Each objCBB In colCBControls
  47.                If objCBB.Caption = strSigName Then
  48.                    objCBB.Execute ' **** see remarks
  49.                    Exit For
  50.               End If
  51.         End If
  52.  End If
  53.  
  54.     If IsNull([ContactMode]) Or ([ContactMode]) = "" Then
  55.       MsgBox "No email is specified."
  56.     ElseIf IsNull([Purpose]) Or ([Purpose]) = "" Then
  57.         MsgBox "There is no subject line."
  58.     ElseIf IsNull([Action]) Or ([Action]) = "" Then
  59.         MsgBox "The email body is empty."
  60.  
  61.        Exit Sub
  62.  
  63.     Else
  64.        stLinkCriteria = Me![ContactMode]
  65.        stSubject = Me![Purpose]
  66.        sthtmlBody = Me![Action]
  67.        DoCmd.SendObject acSendNoObject, , , stLinkCriteria, , , stSubject, sthtmlBody
  68.  
  69.     End If
  70.  
  71.     Set objInsp = Nothing
  72.     Set objItem = Nothing
  73.     Set objDoc = Nothing
  74.     Set objSel = Nothing
  75.     Set objCB = Nothing
  76.     Set objCBB = Nothing
  77.  
  78. StartError:
  79.     MsgBox "No email was sent."
  80.     Exit Sub
  81. End Sub
Apr 2 '07 #1
1 2599
MMcCarthy
14,534 Recognized Expert Moderator MVP
This question is being moved to the Access forum.

ADMIN
Apr 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6762
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...
2
2091
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
2
457
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...
1
374
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
2
4212
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...
1
1790
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:
1
4182
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...
2
5755
abdoelmasry
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
6
2393
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. ...
0
9589
marktang
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...
0
9423
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,...
0
10216
Oralloy
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...
0
10049
jinu1996
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...
1
9997
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,...
0
5309
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...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.