PDA

View Full Version : Quick Help with adding "MSG Box" into code



megha
04-22-2015, 11:26 AM
I have a following code created by someone and i want to add one "MsgBox" that says "your message has been sent" after they click accept or decline button. My question is - where and how do i add this in following two script? Can someone please help? Thank you in advance.

Here is the code:


Sub Accepted_Sendemail()
Dim operator_pass As String
Dim supervisor_pass As String
Dim pass As String

operator_pass = "bw"
supervisor_pass = "fls"
repeat:
pass = TEST
If (pass = operator_pass) Then
email_operator ("I Accept")
ElseIf (pass = supervisor_pass) Then
email_supervisor ("I Accept")
ElseIf (pass = "") Then
GoTo clse
Else
MsgBox ("please enter correct password")
GoTo repeat
End If
ActiveWorkbook.Close SaveChanges:=False
clse:
MsgBox ("Your message is not sent please select the options again for accepting or declining")
End Sub
Sub Declined_Sendemail()
Dim pass As String
Dim operator_pass As String
Dim supervisor_pass As String
operator_pass = "wrr"
supervisor_pass = "fls"
repeat:
pass = TEST
Dim reason As String
If (pass = operator_pass) Then
reason = InputBox("Reason for declining")
reason = "I Decline" & Chr(13) & Chr(10) & "REASON:" & Chr(13) & Chr(10) & reason
email_operator (reason)
ElseIf (pass = supervisor_pass) Then
reason = InputBox("Reason for declining")
reason = "I Decline" & Chr(13) & Chr(10) & "REASON:" & Chr(13) & Chr(10) & reason
email_supervisor (reason)
ElseIf (pass = "") Then
GoTo clse
Else
MsgBox ("please enter correct password")
GoTo repeat
End If
ActiveWorkbook.Close SaveChanges:=False
clse:
MsgBox ("Your message is not sent please select the options again for accepting or declining")
End Sub

mancubus
04-23-2015, 05:07 AM
insert MsgBox functions with relates messages after called sub (email_operator) lines.


ps:
i assume pass = TEST is just for demonstration and you have appropriate code to collect pass value.
otherwise, since TEST is variant and a value is not assigned, TEST is empty and always (pass = "") condition is satisfied.