• SendObject Length Limitation (A2003)

    Author
    Topic
    #426457

    Quick question on using Send Object

    Per users request, I am using code to create a string of names to create an email for. I.e., Joe@xyx.com, sally@aaa.com, Tom@bbb.com. The
    string of names is assigned to Variable ToName. ToName is dimensioned as a string.

    Executing the docmd.sendobject statement (below) works properly.

    DoCmd.SendObject acSendNoObject, , , ToName, , , “Required SOP Training”, “Input Message”, -1

    However, the issue is that the string ToName can exceed 255 characters such that the email To data is truncated to 255 in the email and any characters after 255 are not populated.

    Is there a workaround to get the full ToName string to pass into the To field if its length exceeds 255 when using SendObject?

    I can use mailing lists but the users want a visible record of whom the email was sent to, not just the mailing list. By the way, the email system is Lotus Notes.

    Viewing 0 reply threads
    Author
    Replies
    • #985623

      The only workaround I can think of is to break the ToName string into pieces not exceeding 255 characters in length, and to call DoCmd.SendObject for each piece.

      • #985639

        Thanks Hans,

        But wouldn’t doing that create two or more email documents instead of one?

        As an alternative, I figured I could use the CC and BCC fields so 765 characters would be available.

        I also looked at another post to work with Lotus Notes directly in code that I may go back to but I had problems with the code executing (not the code but our setup).

        I think I will check the outlook boards to see how to programatically populate the data and see if I can get it to work.

        Thanks for your help.

        • #985642

          I’m afraid I can’t help you with automating Lotus Notes, so good luck.

        • #989259

          again, clutching at straws…

          You say you’re passing the SendTo in as a string. Have you tried passing it in as an array? Below is an outline of how I do it, but I’ve never gone for large distribution lists so don’t really know if this will help – we tend to set up mailgroups for each automated report. In the example below, the mailgroups could contain upto 30 people each. Would that work for you?

          ‘~~~~~~~~~~~~~~~~~~~~~~~~~~~
          Sub SendDailies_SAPFGI()
          Dim strSubject As String
          Dim strDistList As Variant
          Dim strBody As Variant

          strSubject = “SAPFGIReport”
          strDistList = Array(“EMEA DISTRIBUTION”, “AMI DISTRIBUTION”, “APR DISTRIBUTION”)
          strBody = Array(“Today’s FGI report as at 08:00 GMT” , PATH_TEXTFILES & “SAPFGIReport.txt” , “regards” , “Brooke”)

          Call SendLotusNotesEmail(strDistList, strSubject, , strBody)
          End Sub
          ‘~~~~~~~~~~~~~~~~~~~~~~~~~~~

          the main sub – with most code stripped out, is as below:

          ‘~~~~~~~~~~~~~~~~~~~~~~~~~~~
          Sub SendLotusNotesEmail (varDistList As Variant, strSubject As String, Optional varCopyList As Variant, Optional varBody As Variant, Optional strPriority As String = “N”, Optional strImportance As String = “2”)

          ‘declare notes objects
          ‘declare standard variables
          ‘set up document
          ‘assign standard document values

          ‘assign passed document values
          doc.Subject = strSubject ‘give it a subject
          doc.SendTo = varDistList ‘set the SendTo field to the distribution list
          doc.CopyTo = varCopyList

          ‘build body of email here if you want to

          ‘get rid of the thing
          Call doc.SEND(False, doc.SendTo)
          Call doc.Save(False, False)

          ‘kill all notes references
          End Sub
          ‘~~~~~~~~~~~~~~~~~~~~~~~~~~~

          HTH

          • #989320

            Thanks for the suggestion. I did find out about arrays while researching using lotus notes. Rather then mess with the arrays I wound up looping through the names selected and then automating the process of sending an email to each user selected one after another. This actually solved another problem in that they wanted a historical record of what was sent to whom and a timestamp of when it was sent. I have a query updating a table with this information after each email is sent. Works quite well.

            Again, thanks for the suggestion.

    Viewing 0 reply threads
    Reply To: SendObject Length Limitation (A2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: