Hi
I'm strugglig work with a Mailto hyperlink code. My code functions as follows:
What i need is, in this new email, the subject line should include the trade number which is a variable i declared initially in my code.
Below are the elements of my code. The items in red is what i am struggling to figure out. As i mentioned i am trying to include in the subject the "StrTradeNo".
Dim StrTradeNo As String
StrTradeNo = Sheets("Data").Cells(lCounter, 10)
TempFileName = "Settlement Confirmation: " & StrTradeType & " - " & StrCounter & " - " & StrValueDate & " TradeID: " & StrTradeNo
Set rng = Nothing
On Error Resume Next
'Only the visible cells in the selection
'Set rng = Selection.SpecialCells(xlCellTypeVisible)
'You can also use a fixed range if you want
Set rng = Sheets("Data").Range(Cells(lCounter, 3), Cells(lCounter, 7)).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
StrBody1 = "Dear Client" & "
" & _
"Please kindly confirm the below:" & "
"
StrBody2 = "Click here to reponse: < a href=' mailto: name surname< emial address >?Subject=Payment Confirmation: Confirmed' & StrTradeNo&'&Body=Please kindly proceed with payment.%0A%0AThank you.'> Confirmed" & "< /a >< br >"
StrBody3 = "Click here to reponse: < a href='mailto: name surname< email address >?Subject=Payment Confirmation: Not Confirmed & Body=Please DO NOT proceed with payment.%0A%0AThank you. '> Not Confirmed" & "< /a >< br >< br >"
StrBody4 = "< br >< br >" & "Kind Regards" & "< br >" & _
"CIB Confirmation | Global Markets Operations | Standard Bank"
On Error GoTo Err_Email_not_Sent:
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = TempFileName
.HTMLBody = StrBody1 & RangetoHTML(rng) & "< br >" & StrBody2 & StrBody3 & StrBody4
'.Send 'or
.Display
End With
I'm strugglig work with a Mailto hyperlink code. My code functions as follows:
- a FOR loop will run ror every row in my sheet called "DATA"
- For every row and email will generate with certain details
- On this email there are two Mailto links available to either "confirm" or "not confirm"
- If the user clicks "Confirm" or "Not Confirm" a new email message will display.
What i need is, in this new email, the subject line should include the trade number which is a variable i declared initially in my code.
Below are the elements of my code. The items in red is what i am struggling to figure out. As i mentioned i am trying to include in the subject the "StrTradeNo".
Dim StrTradeNo As String
StrTradeNo = Sheets("Data").Cells(lCounter, 10)
TempFileName = "Settlement Confirmation: " & StrTradeType & " - " & StrCounter & " - " & StrValueDate & " TradeID: " & StrTradeNo
Set rng = Nothing
On Error Resume Next
'Only the visible cells in the selection
'Set rng = Selection.SpecialCells(xlCellTypeVisible)
'You can also use a fixed range if you want
Set rng = Sheets("Data").Range(Cells(lCounter, 3), Cells(lCounter, 7)).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
StrBody1 = "Dear Client" & "
" & _
"Please kindly confirm the below:" & "
"
StrBody2 = "Click here to reponse: < a href=' mailto: name surname< emial address >?Subject=Payment Confirmation: Confirmed' & StrTradeNo&'&Body=Please kindly proceed with payment.%0A%0AThank you.'> Confirmed" & "< /a >< br >"
StrBody3 = "Click here to reponse: < a href='mailto: name surname< email address >?Subject=Payment Confirmation: Not Confirmed & Body=Please DO NOT proceed with payment.%0A%0AThank you. '> Not Confirmed" & "< /a >< br >< br >"
StrBody4 = "< br >< br >" & "Kind Regards" & "< br >" & _
"CIB Confirmation | Global Markets Operations | Standard Bank"
On Error GoTo Err_Email_not_Sent:
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = TempFileName
.HTMLBody = StrBody1 & RangetoHTML(rng) & "< br >" & StrBody2 & StrBody3 & StrBody4
'.Send 'or
.Display
End With