Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
This wordoc needs to have active hyper links on it.
Is it possible to make them activate on the wordoc or is their a different way of producing the link into the Email.
The code to create the wordoc is below
Is it possible to make them activate on the wordoc or is their a different way of producing the link into the Email.
The code to create the wordoc is below
VBA Code:
Option Explicit
Sub SendDailyMailEmail()
Dim wb As Workbook
Dim ws As Worksheet
Dim tbl As Range
Dim LRow As Long
Dim EmailApp As Object, EmailItem As Object
Dim Pic As Picture
Dim WordDoc
Set EmailApp = CreateObject("Outlook.Application")
Set EmailItem = EmailApp.CreateItem(0)
Set wb = Workbooks("MyPersonal.xlsb")
Set ws = wb.Sheets("DailyMail")
LRow = ws.Cells(Rows.Count, 1).End(xlUp).Row
Set tbl = ws.Range("A1:Q" & LRow)
ws.Activate
tbl.Copy
Set Pic = ws.Pictures.Paste
Pic.Select
Pic.Cut
With EmailItem
.To = ""
.Subject = "Daily Mail" & " " & Format(Date, "dd-mm-yy")
.Display
Set WordDoc = EmailItem.GetInspector.WordEditor
With WordDoc.Range
.PasteAndFormat 13
.InsertParagraphafter
.InsertParagraphafter
.InsertAfter "Kind Regards,"
End With
End With
On Error GoTo 0
With EmailItem
.To = strStaffEmails
.CC = ""
.Subject = "Daily Mail"
End With
Set EmailItem = Nothing
Set EmailApp = Nothing
End Sub