Let me explain what all are my need. I am working on a macro in outlook with the help of vba. I created a form once user will fill up the form, i want to send it in body of email. i am able to send e-mail with the data(value of form), but i need the graphics in the e-mail body. like whatever is my form layout, the same should be shown in e-mail body with the value.
Need to send a form in E-mail body after filling it up.
Can anyone please help out me.
right now i am using below code. But it's not worth, i have to do a long coding in html for layout of e-mail body.
Expand|Select|Wrap|Line Numbers
- Private Sub sendbutton_Click()
- Dim OutlookApp As Object
- Dim MItem As Object
- Dim email_ As String
- Dim subject_ As String
- Dim body_ As String
- Dim attach_ As String
- Set OutlookApp = CreateObject("Outlook.Application")
- subject_ = "Shift Handover" & ShiftHandover.TextBox15.Value
- body_ = "<html><Style>Body{background-color:#19478D;}h1{background-color:#E68A2E;Text-Align:center}</Style><body><h1>Data Center Shift Handover</h1></body></html>" & vbNewLine & "How are you doing today?" & vbNewLine & vbNewLine & "Have you voted yet?"
- 'create Mail Item and send it
- Set MItem = OutlookApp.CreateItem(0)
- 'Application.DisplayAlerts = False
- With MItem
- .To = "ransingh.yadav@bsci.com"
- .Subject = subject_
- .BodyFormat = olFormatHTML
- .HTMLBody = body_
- '.Attachments.Add "C:\FolderName\Filename.txt"
- .Send
- End With
- 'Application.DisplayAlerts = True
- Unload Me
- End Sub