Log in

View Full Version : Solved: Confirmation Email



junglej815
01-07-2009, 10:02 AM
Hello...not sure if its possible but...

What I have is a word document with activeX textboxes and a command button that serves the purpose of a submit button. When that is clicked it opens a new mail message with the document attached ready to be emailed. The for that to happen is as follows:

Public Sub commandbutton1_click()
Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save
With EmailItem
.Subject = "Content Conference Room Request"
.Body = "" & vbCrLf & _
"" & vbCrLf & _
""
.To = "facilitiesservicescenter@blank.com (facilitiesservicescenter@blank.com)"
.Importance = olImportanceNormal 'Or olImprotanceHigh Or olImprotanceLow
.Attachments.Add Doc.FullName
.Display
End With

Application.ScreenUpdating = True
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub

What I am looking for:

Is there any additional code that could be put into the word document code so that when the "submit" button is clicked an email is sent to the person who clicked it saying that their request was received? Or is that something that would be done in Outlook?

Thanks,
Hope its clear as to what im looking for.

JP2112
01-07-2009, 09:06 PM
One way is to set the MailItem.OriginatorDeliveryReportRequested Property to True; that way whomever sends out the email will get a return receipt for the email, showing delivery of that email.

Or you could use some Outlook VBA code at the receiving end, responding to your emails with a confirmation reply.


FYI -- If your code is late bound, you should change

Set EmailItem = OL.CreateItem(olMailItem)

to

Set EmailItem = OL.CreateItem(0)

But if you've set a reference to the Outlook object library from the Word VBIDE, then you should be declaring your Outlook objects as Outlook.Application and Outlook.MailItem


Dim OL As Outlook.Application
Dim EmailItem As Outlook.MailItem



HTH


Hello...not sure if its possible but...

What I have is a word document with activeX textboxes and a command button that serves the purpose of a submit button. When that is clicked it opens a new mail message with the document attached ready to be emailed. The for that to happen is as follows:

Public Sub commandbutton1_click()
Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save
With EmailItem
.Subject = "Content Conference Room Request"
.Body = "" & vbCrLf & _
"" & vbCrLf & _
""
.To = "facilitiesservicescenter@blank.com (facilitiesservicescenter@blank.com)"
.Importance = olImportanceNormal 'Or olImprotanceHigh Or olImprotanceLow
.Attachments.Add Doc.FullName
.Display
End With

Application.ScreenUpdating = True
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub

What I am looking for:

Is there any additional code that could be put into the word document code so that when the "submit" button is clicked an email is sent to the person who clicked it saying that their request was received? Or is that something that would be done in Outlook?

Thanks,
Hope its clear as to what im looking for.

junglej815
01-08-2009, 06:23 AM
Thanks for getting back to me. Sorry but I don't really know all that much about vb coding...

so I would type

MailItem.OriginatorDeliveryReportRequestedProperty =True

into my coding? or what would be the proper code?

thanks again.

JP2112
01-08-2009, 06:28 AM
Your MailItem Object is 'EmailItem', so the code would be

EmailItem.OriginatorDeliveryReportRequested = True

However you're using a With Block, so right after 'With EmailItem', put this:

.OriginatorDeliveryReportRequested = True


HTH


Thanks for getting back to me. Sorry but I don't really know all that much about vb coding...

so I would type

MailItem.OriginatorDeliveryReportRequestedProperty =True

into my coding? or what would be the proper code?

thanks again.

junglej815
01-08-2009, 07:37 AM
Awesome, thanks a lot.

Do you know if there's a way to maybe change what that message says?

So instead of the...
Your message has been delivered to the following recipients:
JoeSchmoe@soandso.com

Subject: Hello

It could say something else.....or is that not an option?

JP2112
01-08-2009, 07:52 AM
The returned message is actually a system-generated ReportItem which you can't customize beforehand. All you could do is write some event code which would monitor your Inbox for new ReportItems and edit them on the fly.




Awesome, thanks a lot.

Do you know if there's a way to maybe change what that message says?

So instead of the...
Your message has been delivered to the following recipients:
JoeSchmoe@soandso.com

Subject: Hello

It could say something else.....or is that not an option?

junglej815
01-08-2009, 08:03 AM
Cool..thanks a lot for your help.