This code sends a Word Doc

Eric Penfold

Active Member
Joined
Nov 19, 2021
Messages
424
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
The code sends a word doc email but the text in the word doc is blurry how could improve the text quality?

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 Shape1 As shape, Shape2 As shape
    Dim MyShp  As shape
    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 = "Drainfast Daily Mail" & " " & Format(Date, "dd-mm-yy")
        .Display
        Set WordDoc = EmailItem.GetInspector.WordEditor
        With WordDoc.Range
            .InsertParagraphafter
            .PasteAndFormat 13
            .Application.Selection.TypeText Text:=""
            .Application.Selection.HomeKey unit:=5, Extend:=1
            .Application.Selection.EndKey unit:=6
            .Hyperlinks.Add Anchor:=.Application.Selection.Range, Address:= _
                             "https://app.smartsheet.com/b/form/05bee75bfa6a47b7b5c5cff74e64dc3d", SubAddress:="", ScreenTip:="", TextToDisplay:="Brainstorm Suggestions"
            .Application.Selection.TypeText Text:=" - "
            .Hyperlinks.Add Anchor:=.Application.Selection.Range, Address:= _
                             "\\somepath\filename.xlsx", SubAddress:="", ScreenTip:="", TextToDisplay:="Product Ideas"
           
            .Application.Selection.HomeKey unit:=5, Extend:=1
            .Application.Selection.ParagraphFormat.Alignment = 1
            .InsertParagraphafter
            .InsertParagraphafter
            .InsertAfter "Kind Regards,"
        End With
    End With
   
    On Error GoTo 0
   
    Set EmailItem = Nothing
    Set EmailApp = Nothing
   
End Sub
 
This works except it need to be as big as possible on the Word Document. It`s placed in the middle but i think it needs to from top left corner down to bottom right corner to fill the whole page.
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I had it set to fill the whole page so I'm not sure. You can jigger with scale height & scale width and/or the autoformat stuff. Are you still doing all that other stuff that your original post included (ie. inserting a paragraph before the paste)? Trial just the code without the Word editor. Maybe the default page layout is different (if that matters)? Sorry, I really don't have any other suggestions. Dave
 
Upvote 0

Forum statistics

Threads
1,215,091
Messages
6,123,062
Members
449,089
Latest member
ikke

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