Insert email signature after a table is pasted.

JiggersBass

New Member
Joined
May 20, 2022
Messages
13
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
To who it may concern,
I was assisted here on creating an email where I can paste a table or an image of the table using the below code, but I cannot find a way to insert my signature, the command line would always turn red. I also find it hard to keep the format of the table to fit contents all the time.

Private Sub CommandButton1_Click()
Dim r As Range
Set r = Range("a1:g13")
r.Copy
Dim outlookApp As Object
Set outlookApp = CreateObject("Outlook.Application")
Dim outMail As Object
Set outMail = outlookApp.CreateItem(0)
Dim strBody As String
strBody = "Hi Team," & vbNewLine & vbNewLine & _
"Kindly see below attendance for my team:"

With outMail
.display
.To = Range("a15").Value
.cc = Range("a16").Value
.Subject = Range("a17").Value
.body = strBody
Dim wordDoc As Object
Set wordDoc = .GetInspector.WordEditor
End With

With wordDoc
.Application.Selection.EndKey Unit:=6 'wdStory
.Application.Selection.TypeParagraph
.Application.Selection.PasteAndFormat 10 'wdChartPicture
End With


'To paste as a table
'wordDoc.Range.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=False
End Sub
 

Attachments

  • Mail.png
    Mail.png
    38.5 KB · Views: 22
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
This is how I format the table all the time and the end result.
 

Attachments

  • Mail2.png
    Mail2.png
    53.7 KB · Views: 14
  • Mail3.png
    Mail3.png
    30.6 KB · Views: 17
Upvote 0
To who it may concern,
I was assisted here on creating an email where I can paste a table or an image of the table using the below code, but I cannot find a way to insert my signature, the command line would always turn red. I also find it hard to keep the format of the table to fit contents all the time.

Private Sub CommandButton1_Click()
Dim r As Range
Set r = Range("a1:g13")
r.Copy
Dim outlookApp As Object
Set outlookApp = CreateObject("Outlook.Application")
Dim outMail As Object
Set outMail = outlookApp.CreateItem(0)
Dim strBody As String
strBody = "Hi Team," & vbNewLine & vbNewLine & _
"Kindly see below attendance for my team:"

With outMail
.display
.To = Range("a15").Value
.cc = Range("a16").Value
.Subject = Range("a17").Value
.body = strBody
Dim wordDoc As Object
Set wordDoc = .GetInspector.WordEditor
End With

With wordDoc
.Application.Selection.EndKey Unit:=6 'wdStory
.Application.Selection.TypeParagraph
.Application.Selection.PasteAndFormat 10 'wdChartPicture
End With


'To paste as a table
'wordDoc.Range.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=False
End Sub
I don't know what syntax to use to keep the format when the table is pasted and insert a signature after the table.
 
Upvote 0

Forum statistics

Threads
1,223,645
Messages
6,173,523
Members
452,520
Latest member
Pingaware

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top