Apologies if this has been "done to death" numerous times but never having used Outlook I need all the help I can get.
The following programme was SUPPOSED to send e-mails and cc: mails through Outlook automatically. As shown on the worksheet I set it to mail two of my own addresses, one on Hotmail and one on my website.
Code:
Sub SendWithAtt()
Dim c As Range
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim CurrFile As String
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
Sheet1.Select
With olMail
For Each c In Range("STATUS")
If c = "NO" Then
.To = c.Offset(0, 4).Value
.CC = c.Offset(0, 5).Value
.Subject = c.Offset(0, 2).Value
.Body = c.Offset(0, 3).Value
.Send
End If
Next
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub
But running the routine a msgbox appears telling me “The network connection is temporarily unavailable and the message will be kept in the Outbox until the connection is restored”.
When I opened Outlook a msgbox said “We were unable to sign in to your account. Please try again, We currently cannot access your account. Please try again.”
So I opened up the Outbox, opened the first mail in the folder. , tried pressing “Send” and got the original Messagebox appearing.
Returned to Excel VBA code. Found programme highlighting the “To” field with a msgbox saying “RunTime Error 462. The remote server machine does not exist or is unavailable”.
So not only does my code not work, I seem to have "done something" to my Outlook!
Excel sheet is attached as a "screenprint" as I could not upload the Macro-enabled file.
Any guidance accepted gratefully
Bob Allen-Turl