G
Glenn Ray
I am trying to use the FollowHyperlink method to generate an email using the
default client. Works with Outlook, but not with Lotus Notes; it activates
Lotus Notes, but does not initiate an email message.
To test, I created a simplified version of the same routine in another
workbook and this second program DID work!
This may be a "forest for the trees" issue, but can anyone point out the
*significant* differences between the two routines that would prevent the
first from working? (I mean, besides the first set of nested IF Then...Else
statements at the start of the first routine)
Thanks in advance
- Glenn Ray
========First Routine (not working) ===========
'This is a Click event inside a user form (frmRejectEmail)
Option Explicit
Dim stext, sAddedtext As String
Private Sub btnSend_Click()
frmRejectEmail.Hide
boolRej = True
On Error GoTo Err_Send_Click
If frmRejectEmail.chSuprCC.Value = True Then
If Range("SuprEmail").Value = Range("UserEmail").Value Then
sAddedtext = "&BCC=" & Range("SuprEmail").Value
Else
sAddedtext = "&CC=" & Range("SuprEmail").Value
sAddedtext = sAddedtext & "&BCC=" & Range("UserEmail").Value
End If
End If
sAddedtext = sAddedtext & "&Subject=" & frmRejectEmail.lblSubject.Caption
sAddedtext = sAddedtext & "&Body=" & frmRejectEmail.lblDefaultMsg.Caption
If frmRejectEmail.txtMsgBody.Value <> "" Then
sAddedtext = sAddedtext & " - " & frmRejectEmail.txtMsgBody.Value
End If
stext = "mailto:" & strEmail
Mid$(sAddedtext, 1, 1) = "?"
stext = stext & sAddedtext
ThisWorkbook.FollowHyperlink stext
Exit_Send_Click:
Exit Sub
Err_Send_Click:
MsgBox Err.Description & vbLf & "Contact Glenn Ray for assistance."
Resume Exit_Send_Click
End Sub
=======Second routine (works)==============
Option Explicit
Dim strtext As String
Dim chSuprCC As Boolean
Const strMsgBody as String = "And another thing..."
Sub Send_mail2()
On Error GoTo Err_Send_Click
chSuprCC = True
Dim stext As String
Dim sAddedtext As String
If chSuprCC = True Then
sAddedtext = "&BCC=" & "(e-mail address removed)"
End If
sAddedtext = sAddedtext & "&Subject=" & "this is the subject"
sAddedtext = sAddedtext & "&Body=" & "you messed up and this is what
you're gonna do about it"
If strMsgBody <> "" Then
sAddedtext = sAddedtext & " - " & vbCrLf & vbCrLf & strMsgBody
End If
stext = "mailto:" & "(e-mail address removed)"
Mid$(sAddedtext, 1, 1) = "?"
stext = stext & sAddedtext
ThisWorkbook.FollowHyperlink stext
Exit_Send_Click:
Exit Sub
Err_Send_Click:
MsgBox Err.Description
Resume Exit_Send_Click
End Sub
default client. Works with Outlook, but not with Lotus Notes; it activates
Lotus Notes, but does not initiate an email message.
To test, I created a simplified version of the same routine in another
workbook and this second program DID work!
This may be a "forest for the trees" issue, but can anyone point out the
*significant* differences between the two routines that would prevent the
first from working? (I mean, besides the first set of nested IF Then...Else
statements at the start of the first routine)
Thanks in advance
- Glenn Ray
========First Routine (not working) ===========
'This is a Click event inside a user form (frmRejectEmail)
Option Explicit
Dim stext, sAddedtext As String
Private Sub btnSend_Click()
frmRejectEmail.Hide
boolRej = True
On Error GoTo Err_Send_Click
If frmRejectEmail.chSuprCC.Value = True Then
If Range("SuprEmail").Value = Range("UserEmail").Value Then
sAddedtext = "&BCC=" & Range("SuprEmail").Value
Else
sAddedtext = "&CC=" & Range("SuprEmail").Value
sAddedtext = sAddedtext & "&BCC=" & Range("UserEmail").Value
End If
End If
sAddedtext = sAddedtext & "&Subject=" & frmRejectEmail.lblSubject.Caption
sAddedtext = sAddedtext & "&Body=" & frmRejectEmail.lblDefaultMsg.Caption
If frmRejectEmail.txtMsgBody.Value <> "" Then
sAddedtext = sAddedtext & " - " & frmRejectEmail.txtMsgBody.Value
End If
stext = "mailto:" & strEmail
Mid$(sAddedtext, 1, 1) = "?"
stext = stext & sAddedtext
ThisWorkbook.FollowHyperlink stext
Exit_Send_Click:
Exit Sub
Err_Send_Click:
MsgBox Err.Description & vbLf & "Contact Glenn Ray for assistance."
Resume Exit_Send_Click
End Sub
=======Second routine (works)==============
Option Explicit
Dim strtext As String
Dim chSuprCC As Boolean
Const strMsgBody as String = "And another thing..."
Sub Send_mail2()
On Error GoTo Err_Send_Click
chSuprCC = True
Dim stext As String
Dim sAddedtext As String
If chSuprCC = True Then
sAddedtext = "&BCC=" & "(e-mail address removed)"
End If
sAddedtext = sAddedtext & "&Subject=" & "this is the subject"
sAddedtext = sAddedtext & "&Body=" & "you messed up and this is what
you're gonna do about it"
If strMsgBody <> "" Then
sAddedtext = sAddedtext & " - " & vbCrLf & vbCrLf & strMsgBody
End If
stext = "mailto:" & "(e-mail address removed)"
Mid$(sAddedtext, 1, 1) = "?"
stext = stext & sAddedtext
ThisWorkbook.FollowHyperlink stext
Exit_Send_Click:
Exit Sub
Err_Send_Click:
MsgBox Err.Description
Resume Exit_Send_Click
End Sub