Re: What's wrong in my Access 2003?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On 30 kesä, 16:45, "Brendan Reynolds"
<brenr...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Did you read the tutorial? Did you add the necessary code to the Outlook VBA
project as explained in the tutorial?

--
Brendan Reynolds

"hanski" <lappalainen.ha...@xxxxxxxxxx> wrote in message

news:034adb1e-fe7f-4dee-8d7a-3cf2b8382245@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Hi.

I have a module: (not mine, as you see)

Option Explicit

' ACCESS VBA MODULE: Send E-mail without Security Warning
' (c) 2005 Wayne Phillips (http://www.everythingaccess.com)
' Written 07/05/2005
' Last updated v1.3 - 11/11/2005
'
' Please read the full tutorial & code here:
'
http://www.everythingaccess.com/tutorials.asp?ID=Outlook-Send-E-mail-....
'
' Please leave the copyright notices in place - Thank you.

'This is a test function - replace the e-mail addresses with your own
before executing!!
'(CC/BCC can be blank strings, attachments string is optional)

Sub FnTestSafeSendEmail()
   Dim blnSuccessful As Boolean
   Dim strHTML As String

   strHTML = "<html>" & _
              "<body>" & _
              "My <b><i>HTML</i></b> message text!" & _
              "</body>" & _
              "</html>"
   blnSuccessful = FnSafeSendEmail("myemailaddr...@xxxxxxxxxx", _
                                   "My Message Subject", _
                                   strHTML)

   'A more complex example...
   'blnSuccessful = FnSafeSendEmail("myemailaddr...@xxxxxxxxxx;
secondrecipi...@xxxxxxxxxx", _
                                        "My Message Subject", _
                                        strHTML, _
                                        "C:\MyAttachmentFile1.txt; C:
\MyAttachmentFile2.txt", _
                                        "cc_recipi...@xxxxxxxxxx", _
                                        "bcc_recipi...@xxxxxxxxxx")
   If blnSuccessful Then

       MsgBox "E-mail message sent successfully!"

   Else

       MsgBox "Failed to send e-mail!"

   End If

End Sub

'This is the procedure that calls the exposed Outlook VBA function...
Public Function FnSafeSendEmail(strTo As String, _
                   strSubject As String, _
                   strMessageBody As String, _
                   Optional strAttachmentPaths As String, _
                   Optional strCC As String, _
                   Optional strBCC As String) As Boolean

   Dim objOutlook As Object ' Note: Must be late-binding.
   Dim objNameSpace As Object
   Dim objExplorer As Object
   Dim blnSuccessful As Boolean
   Dim blnNewInstance As Boolean

   'Is an instance of Outlook already open that we can bind to?
   On Error Resume Next
   Set objOutlook = GetObject(, "Outlook.Application")
   On Error GoTo 0

   If objOutlook Is Nothing Then

       'Outlook isn't already running - create a new instance....
       Set objOutlook = CreateObject("Outlook.Application")
       blnNewInstance = True
       'We need to instantiate the Visual Basic environment...
(messy)
       Set objNameSpace = objOutlook.GetNamespace("MAPI")
       Set objExplorer =
objOutlook.Explorers.Add(objNameSpace.Folders(1), 0)
       objExplorer.CommandBars.FindControl(, 1695).Execute

       objExplorer.Close

       Set objNameSpace = Nothing
       Set objExplorer = Nothing

   End If

   blnSuccessful = objOutlook.FnSendMailSafe(strTo, strCC, strBCC, _
                                               strSubject,
strMessageBody, _
                                               strAttachmentPaths)

   If blnNewInstance = True Then objOutlook.Quit
   Set objOutlook = Nothing

   FnSafeSendEmail = blnSuccessful

End Function
---------------------------------------------------------------------------­---------------------------------------------

It gives me on error "Object doesn't support this property or method"
when it is in
"blnSuccessful = objOutlook.FnSendMailSafe(strTo, strCC, strBCC, _
                                               strSubject,
strMessageBody, _
                                               strAttachmentPaths)"

What's wrong?

Hanski- Piilota siteerattu teksti -

- Näytä siteerattu teksti -

Yes, i did add the code to the Outlook and I tested it and it worked
fine.

I suppose something is missing from my Access, maybe in Vba
References?

Hanski
.



Relevant Pages

  • Re: Template Issues from Staging Server to Production Server
    ... template to the Site Template Gallery, ... Callstack:    at ... strTitle, String strDescription, UInt32 nLCID, String strWebTemplate, ... Boolean bCreateUniqueSubweb, Boolean bConvertIfThere, Guid webId, Guid ...
    (microsoft.public.sharepoint.portalserver)
  • Re: 11-string recuerdos- where on the bell curve?
    ...   Yes, a couple of the ornaments in the first section did not come out ... which there is not room for improvement, slurs included, but I do not ... This is my recording of Recuerdos done on six string several years ... a heavier bass? ...
    (rec.music.classical.guitar)
  • Re: Export multiple versions of a query to separate Excel files
    ... If I try to run the code I can select the folder that I want to create ... Dim qdf As DAO.QueryDef ... Dim strSQL As String, strTemp As String, strMgr As String ...
    (microsoft.public.access.externaldata)
  • Re: Using String for new List name
    ...     for line in infile: ... and aclS represents "access control list String." ... My quest, if you will, is to create a list of syslog entries, each ... Since ACL rules can be written with a range of granularity, ...
    (comp.lang.python)
  • Re: Macro to delete rows until a row contains a certain text strin
    ... Dim rngStartCell As Range ... Dim strToFindStart As String ...     'Test if any rows between first and last identifiers ... starting cell to one row before the row containing "KM In". ...
    (microsoft.public.excel.programming)