I'm working in Excel VBA to autosend mail every day.
When I manually run my code the email has all the information needed.
When I use task scheduler to open my workbook at a specific time and send the email, it will be missing my (graph & table) pasted range.
Edit: I commented On Error Resume Next and the error comes out at: (wordDoc.Range(Start:=wordDoc.Range.End - 1).PasteAndFormat wdChartPicture)
Sub Send_AutoMail()
    Dim rng1 As Range, r As Range
  
    Set r = Nothing
    'On Error Resume Next
    Sheets("maindata").Select
    Set r = Range("V4:AL78")
    r.Copy
    Set rng1 = Nothing
    'On Error Resume Next
    Sheets("LatestWeek").Select
    Range("R7").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToLeft)).Select
    Set rng1 = Selection.SpecialCells(xlCellTypeVisible)
    Dim outlookApp As Outlook.Application
    Set outlookApp = CreateObject("Outlook.Application")
    Dim outMail As Outlook.MailItem
    Set outMail = outlookApp.CreateItem(olMailItem)
    outMail.Display
    Dim wordDoc As Word.Document
    Set wordDoc = outMail.GetInspector.WordEditor
    Dim shp As Object
    With outMail
        .Subject = "Testing[Daily]"
        .To = ""
        .HTMLBody = "<font style=font-family:Calibri>Hi All," & "<P>" & "TrendChart: PLT</font>" & "</P><P><br>"
        wordDoc.Range(Start:=wordDoc.Range.End - 1).PasteAndFormat wdChartPicture
        For Each shp In wordDoc.InlineShapes
            shp.ScaleHeight = 100
            shp.ScaleWidth = 100
        Next
        .HTMLBody = .HTMLBody & "</P><br>" & "<b><font style=font-family:Calibri color='red'>LOH</b></font>" & "</P>" & "<br><br>"
        rng1.Copy
        wordDoc.Range(Start:=wordDoc.Range.End - 1).PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=False
        wordDoc.Tables(1).Borders.OutsideLineStyle = wdLineStyleSingle
        wordDoc.Tables(1).Borders.OutsideLineWidth = wdLineWidth225pt
        wordDoc.Tables(1).Borders.OutsideColor = wdColorGray25
        .HTMLBody = .HTMLBody & "<font style=font-family:Calibri>Regards," 
    End With
         
   'outMail.Send
End Sub
 
    