uwlchemist
New Member
- Joined
- Aug 29, 2009
- Messages
- 38
I am getting the dreaded "Object reference not set to an instance of an object" error on the following code. The code hangs on the ".send" line, but I haven't been able to figure out why. Furthermore, it only hange on some users computers, not all (not mine, of course, which makes troubleshooting a pain). Any insight would be greatly appreciated. Thank you!!
Code:
Sub SendLink()
' Send a brief message notifying the project manager that a new test
' has been completed and sends the filepath to the saved file
Dim OutApp As Object ' Outlook Application
Dim OutMail As Object ' New e-mail message
Dim strFilePath As String ' File path of file you are notifying project manager about
Dim ProjectNumber As Range ' Project number data file pertains to
Dim strEMail As String ' E-mail address of project manager
Dim Response As Integer ' Response to user action
Set ProjectNumber = Range("ProjectNumber")
strEMail = Range("EMail").Value
strFilePath = ActiveWorkbook.FullNameURLEncoded
If Range("EMail").Value = "" Then
MsgBox "Text_
Exit Sub
End If
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = strEMail
.CC = ""
.BCC = ""
.Subject = "Text"
.Body = "Text " _
[B][U][COLOR=red] .Send[/COLOR][/U][/B]
MsgBox "Your e-mail has been sent"
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub