Consulting

Results 1 to 3 of 3

Thread: Trying to create Submit button that will attach the form created in Excel via Lotus

  1. #1
    VBAX Newbie
    Joined
    Sep 2014
    Posts
    5
    Location

    Trying to create Submit button that will attach the form created in Excel via Lotus

    I have a form that currently users complete, save and then email to me as attachment via Lotus notes.
    I would like them to be able to just click a 'Submit' button and have Lotus open and auto attach the form.
    and pre-populate the email address it should be sent to (auto subject line would be nice too but less of a priority).

    I am very new to this and trying to teach myself with little success.
    Any instructions created for a newbie would be would be greatly appreciated and paid forward when able.

    Thanks

    Okay - so trying to work from this - no idea if im on the right track but im getting stopped at the bolded line...help?

    Private Sub CommandButton1_Click()
    Dim Maildb As Object
    Dim MailDoc As Object
    Dim Body As Object
    Dim Session As Object
    Set Session = CreateObject("Lotus.NotesSession")
    Call Session.Initialize
    If Not Maildb.IsOpen = True Then
    Call Maildb.Open
    End If
    Set MailDoc = Maildb.CREATEDOCUMENT
    Call MailDoc.ReplaceItemValue("Form", "Memo")
    Call MailDoc.ReplaceItemValue("Send to", "my email")
    Call MailDoc.ReplaceItemValue("Subject", "Access Request")
    Set Body = MailDoc.CREATERICHTEXTITEM("Body")
    Call Body.APPENDTEXT("Thank you")
    Call Body.ADDNEWLINE(2)
    Call Body.EMBEDOBJECT(1454, "", "C:\filename", "Attachment")
    Call MailDoc.ReplaceItemValue("PostedDate", Now())
    Call MailDoc.SEND(False)
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set Body = Nothing
    Set Session = Nothing
    End Sub
    Last edited by Aussiebear; 09-13-2014 at 06:00 PM. Reason: Placed tags around code

  2. #2
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    266
    Location
    I have made such a form/workbook that we use at work.
    Don't have access to it right now, but if I remember I will bring it home on monday.

    I used "Save as" as the excecution for the code.
    It saves itself with a name defined by what is filled in the form, creates the mail with adresses filled in (depending on whats filled in the form), adds the subject, attaches the file, and writes the message who the mail is from.

    I used some code from a thread here on how to control lotus notes.

  3. #3
    VBAX Newbie
    Joined
    Sep 2014
    Posts
    5
    Location
    Thanks! That would be great if you could post Monday.



    Quote Originally Posted by Ago View Post
    I have made such a form/workbook that we use at work.
    Don't have access to it right now, but if I remember I will bring it home on monday.

    I used "Save as" as the excecution for the code.
    It saves itself with a name defined by what is filled in the form, creates the mail with adresses filled in (depending on whats filled in the form), adds the subject, attaches the file, and writes the message who the mail is from.

    I used some code from a thread here on how to control lotus notes.

Tags for this Thread

Posting Permissions

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