DatabaseTash
Registered User.
- Local time
- Tomorrow, 04:05
- Joined
- Jul 23, 2018
- Messages
- 149
I would like to add the option of emailing a plan as an attachment, once the user has searched for the plan.
I have managed to work out the code to get the email to pop up (very chuffed about that!
).
I would now like to get the code to use the search result (See screen shot for example). So it would use the Plan Number in the subject line and use the Plan Link to attach the file to the email. The attachment files are .pdf or .tif files.
I would like the user to be able to click the button, rather than have to perform an additional search. Is this the best way to do this or is there an easier way? I would be grateful for any suggestions!
I have managed to work out the code to get the email to pop up (very chuffed about that!

I would now like to get the code to use the search result (See screen shot for example). So it would use the Plan Number in the subject line and use the Plan Link to attach the file to the email. The attachment files are .pdf or .tif files.
I would like the user to be able to click the button, rather than have to perform an additional search. Is this the best way to do this or is there an easier way? I would be grateful for any suggestions!
Code:
Option Compare Database
Private Sub Command19_Click()
Dim Msg As String
Msg = "This plan has been sent to you with the help of Survey Central."
Dim O As Outlook.Application
Dim M As Outlook.MailItem
Set O = New Outlook.Application
Set M = O.CreateItem(olMailItem)
With M
.BodyFormat = olFormatHTML
.Subject = "Plan Number " & [Plan Number] & ""
.Display
.HTMLBody = Msg & .HTMLBody
.Attachments.Add "R:\Digital Library\"
End With
Set M = Nothing
Set O = Nothing
End Sub