Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2003
    Location
    Philly area
    Posts
    22

    Unanswered: outlook object model

    For Access 2000, I foud code to send emails using
    Set Email = CreateObject("Outlook.Application").CreateItem(0)
    ...
    Where can I find a help file with details of the properties and methods that I can use for this object.

    Thanks,
    RG
    RG

  2. #2
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820

    Re: outlook object model

    Originally posted by rongrzywacz
    For Access 2000, I foud code to send emails using
    Set Email = CreateObject("Outlook.Application").CreateItem(0)
    ...
    Where can I find a help file with details of the properties and methods that I can use for this object.

    Thanks,
    RG
    if you've inclueded the microsoft outlook lib in the refferences then the help file should be inclued the then just hit F1 on the work outlook
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  3. #3
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820

    Re: outlook object model

    the basics though to send an email are

    Dim email As Outlook.MailItem
    Set email = CreateObject("Outlook.Application").CreateItem(olM ailItem)
    email.To = "String with addresses"
    email.Subject = "String with Subject"
    email.Body = "string with message"
    email.Send


    to collect emails

    Dim inboxcontense As Outlook.Items, email As MailItem
    Dim rs As DAO.Recordset
    Set inboxfolder = CreateObject("Outlook.Application").GetNamespace(" MAPI").GetDefaultFolder(olFolderInbox)
    Set inboxcontense = inboxfolder.Items
    Set rs = CurrentDb.OpenRecordset("jobs", , dbAppendOnly)
    For Each email In inboxcontense
    If email.UnRead Then
    With rs
    .AddNew
    !User = email.SenderName
    !DateReported = email.SentOn
    !DescriptionBrief = email.Subject
    !DescriptionFull = email.Body
    !Status = 1
    .update
    End With
    End If
    email.UnRead = False
    Next
    rs.Close
    End Sub
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  4. #4
    Join Date
    Apr 2003
    Location
    Philly area
    Posts
    22
    Thanks for you help.

    After including outlook in the references, I was able to go to the object browser, select an object/method/event and hit help on it.

    However. I was able to send emails without including references to the Outlook library in my references. Should I include it or not ?
    why did it work before?:

    Thanks
    RG
    RG

  5. #5
    Join Date
    Apr 2003
    Location
    Philly area
    Posts
    22
    Also,
    Previous developers had used
    the docmd.sendobject sytax which had parameters for
    ObjectType , ObjectName, and OutPutFormat

    I don't see properties for these parms. do they still apply?

    I might see the need for changing the output format,
    how would I do that ?

    Thank you very much for you Help!

    RG
    RG

  6. #6
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    here's the help file if you can't find it for sendobject


    SendObject Method
    See Also Applies To Example Specifics
    The SendObject method carries out the SendObject action in Visual Basic.

    expression.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)

    expression Required. An expression that returns one of the objects in the Applies To list.

    ObjectType Optional AcSendObjectType.

    AcSendObjectType can be one of these AcSendObjectType constants.
    acSendDataAccessPage
    acSendForm
    acSendModule
    acSendNoObject default
    acSendQuery
    acSendReport
    acSendTable

    ObjectName Optional Variant. A string expression (string expression: Any expression that evaluates to a sequence of contiguous characters. Elements of the expression can include: a function that returns a string or a string Variant (VarType 8); a string literal, constant, variable, or Variant</.) that's the valid name of an object of the type selected by the objecttype argument. If you want to include the active object in the mail message, specify the object's type with the objecttype argument and leave this argument blank. If you leave both the objecttype and objectname arguments blank (the default constant, acSendNoObject, is assumed for the objecttype argument), Microsoft Access sends a message to the electronic mail application without an included database object. If you run Visual Basic code containing the SendObject method in a library database (library database: A collection of procedures and database objects that you can call from any application. In order to use the items in the library, you must first establish a reference from the current database to the library database.), Microsoft Access looks for the object with this name first in the library database, then in the current database.

    OutputFormat Optional Variant.

    OutputFormat Optional AcFormatType.

    XlSendObjectOutputFormat can be one of these XlSendObjectOutputFormat constants.
    acFormatDAP
    acFormatHTML
    acFormatRTF

    acFormatTXT

    acFormatXLS

    If you leave this argument blank, Microsoft Access prompts you for the output format.


    To Optional Variant. A string expression that lists the recipients whose names you want to put on the To line in the mail message. Separate the recipient names you specify in this argument and in the cc and bcc arguments with a semicolon ( or with the list separator (separator: A character that separates units of text or numbers.) set on the Number tab of the Regional Settings Properties dialog box in Windows Control Panel. If the recipient names aren't recognized by the mail application, the message isn't sent and an error occurs. If you leave this argument blank, Microsoft Access prompts you for the recipients.

    Cc Optional Variant. A string expression that lists the recipients whose names you want to put on the Cc line in the mail message. If you leave this argument blank, the Cc line in the mail message is blank.

    Bcc Optional Variant. A string expression that lists the recipients whose names you want to put on the Bcc line in the mail message. If you leave this argument blank, the Bcc line in the mail message is blank.

    Subject Optional Variant. A string expression containing the text you want to put on the Subject line in the mail message. If you leave this argument blank, the Subject line in the mail message is blank.

    MessageText Optional Variant. A string expression containing the text you want to include in the body of the mail message, after the object. If you leave this argument blank, the object is all that's included in the body of the mail message.

    EditMessage Optional Variant. Use True (1) to open the electronic mail application immediately with the message loaded, so the message can be edited. Use False (0) to send the message without editing it. If you leave this argument blank, the default (True) is assumed.

    TemplateFile Optional Variant. A string expression that's the full name, including the path, of the file you want to use as a template for an HTML (HTML: The standard markup language used for documents on the World Wide Web. HTML uses tags to indicate how Web browsers should display page elements such as text and graphics and how to respond to user actions.) file.

    Remarks
    For more information on how the action and its arguments work, see the action topic.

    Modules can be sent only in MS-DOS Text format, so if you specify acSendModule for the objecttype argument, you must specify acFormatTXT for the outputformat argument.

    You can leave an optional argument blank in the middle of the syntax, but you must include the argument's comma. If you leave a trailing argument blank, don't use a comma following the last argument you specify.

    Example
    The following example includes the Employees table in a mail message in Microsoft Excel format and specifies To, Cc, and Subject lines in the mail message. The mail message is sent immediately, without editing.

    DoCmd.SendObject acSendTable, "Employees", acFormatXLS, _
    "Nancy Davolio; Andrew Fuller", "Joan Weber", , _
    "Current Spreadsheet of Employees", , False
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  7. #7
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    Originally posted by rongrzywacz
    Thanks for you help.

    After including outlook in the references, I was able to go to the object browser, select an object/method/event and hit help on it.

    However. I was able to send emails without including references to the Outlook library in my references. Should I include it or not ?
    why did it work before?:

    Thanks
    RG
    sometimes the createObject method bypasses the need for the reference, but i'd add it anyway as your better safe than sorry
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  8. #8
    Join Date
    Apr 2003
    Location
    Philly area
    Posts
    22
    I would prefer not to use the send object command. It seems to be very flakey. Sometimes it doesn't work, and ususally only works one time in a form.
    Using the outlook object seems to work all of the time with no problems, however, we can't send the results of a query as an excel attachment like we did before.
    Is there a way to do this?

    Thanks.
    RG
    RG

  9. #9
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    I could be wrong - but I thought there were issues with the docmd.sendobject - something to do with viruses like the "I love you virus"

    The SR! and SR2 of office 2000 either disabled it or at the least provided buillt in alerts to notify the user that another program was autoemailing something

    The cdo object model does get around this

  10. #10
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    Originally posted by rongrzywacz
    I would prefer not to use the send object command. It seems to be very flakey. Sometimes it doesn't work, and ususally only works one time in a form.
    Using the outlook object seems to work all of the time with no problems, however, we can't send the results of a query as an excel attachment like we did before.
    Is there a way to do this?

    Thanks.
    RG
    yes and no,

    you can't do it the same way but you can export the data to excel, attach the excel file, send the email and delete the excel file

    as for the sendobject being flaky i've heard about the cant use repeatedly problem but never encountered it, as for the problem with sending emails over X charactors (microsoft says X is 70-2000 but i've had problems on one machine where X was 14) but that problem is machine dependant and is either there or not
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •