Hey everyone,
I have the following code in VBScript.
It works in Outlook 2001 but not in Outlook 2010.
We are running XP SP3.
Is there any code here that wouldn't be recognised by Outlook 2010, or for some reason break with the new version?
Thanks.
On Error GoTo ErrorHandler
Dim oApp As Object
Dim oMail As Object
Dim obody As String
Dim strMail As String
strMail = txtemail2.Text
'Prepare the e-mail
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
obody = obody & "<p style='font-family:arial;font-size:12'>"
obody = obody & "<br />" & "<br />"
obody = obody & "Thank you for submitting your vacancy. "
With oMail
.htmlbody = obody
.To = strMail
.Subject = "Your recent correspondence with us."
.Attachments.Add Environ("TEMP") & "\temp.doc"
.Importance = 2
.Display
End With
Set oMail = Nothing
Set oApp = Nothing
Kill Environ("TEMP") & "\temp.doc"
ActiveDocument.Undo (100)
ErrorHandler:
If Err.Number <> 0 Then
MsgBox "Send unsuccessful. This may be due to exceeding your Outlook Storage Limit." _
& vbCrLf & "If your inbox, deleted and sent items folders are full please delete or archive some items." _
& vbCrLf & "Also please ensure your Team Leader email takes the format name.surname then try again." _
& vbCrLf _
& vbCrLf & "If you still receive this message please contact the Administrator:" _
& vbCrLf & "joebloggs@hello.com", vbSystemModal + vbCritical, "Message Not Sent!"
ActiveDocument.Undo (100)
End If
End Sub