Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Excel 2013 VBA, Looping code problem sending emails in VBA After upgrading to Of

ID: 3561359 • Letter: E

Question

Excel 2013 VBA, Looping code problem sending emails in VBA

After upgrading to Office365 attached macro  does not work anymore. When reaching to the syntax : " Set olNewMail = CreateItem(olMailItem)"

it stops for almost 60 seconds before it continues, but no mail is sent.

Any good ideas ?

Thanks in advance

Sub SendEmail()

Sheets("Tabel").Select

On Error Resume Next

    Dim olApp As Outlook.Application

    Dim olNewMail As Object

    Dim Recep As String

    Dim MsgTxt As String

    Dim Attchedfile As String

    Dim Sti As String

    Dim Varnavn As String

    Dim Vedhaeft As String

    Dim antallinier As String

   

    Sti = "" & Sti1 & ""

    Filende = ".xls"

   

    ' Finder antal linier som skal t

Explanation / Answer

.......Try this : " |"

Sub SendEmail()
' Add reference to Microsoft Outlook Object Library
'
    Dim olApp As Outlook.Application
    Dim olNewMail As Object
    Dim Recep As String, MsgTxt As String, Attchedfile As String, Sti As String, Varnavn As String
    Dim Vedhaeft As String, sidstekolonne As String, Filende As String, sidstecelle As String
    Dim antallinier As Long, i As Long
  
    Sheets("Tabel").Select
    'On Error Resume Next
  
    Sti = "Sti1"                                    'What is Stil1, a string???
    Filende = ".xls"
  
    ' Finder antal linier som skal t