PDA

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



Linas
09-13-2014, 05:15 AM
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.:banghead:
Any instructions created for a newbie would be would be greatly appreciated and paid forward when able.
: pray2:
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

Ago
09-13-2014, 07:28 AM
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.

Linas
09-13-2014, 01:17 PM
Thanks! That would be great if you could post Monday.




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.