Mike Eghtebas
asked on
Reply to email... Pause
In Reply or Forward mode in the following code, I want it to wait for the user to add some additional comments. I know there is a boolean flag needs to be added to:
mai.Send
In some othe application, I have a check box (Me!chkPause) which determines whether there will be a pause or Outlook will send the email without any pause.
How can I incorporate "Me!chkPause" with "mai.Send"
Thank you,
mai.Send
In some othe application, I have a check box (Me!chkPause) which determines whether there will be a pause or Outlook will send the email without any pause.
How can I incorporate "Me!chkPause" with "mai.Send"
Thank you,
Public Sub SearchForItem(strEntryID As String, Optional reply As Boolean, Optional forward As Boolean)
Dim obj_CurrentOlkFolder As Outlook.MAPIFolder
Dim olkApp As Object, _
olkNS As Object, _
OlkFolder As Object, _
olkItem As Object, _
strQuery As String, _
mai As mailitem
If reply = True And forward = True Then Exit Sub
Set olkApp = GetObject(, "Outlook.Application")
Set olkNS = olkApp.Session
Set olkItem = olkNS.GetItemFromID(strEntryID)
If olkItem.Class = olMail Then
Set mai = olkItem
If reply Then
mai.reply
mai.Body = mai.Body & vbCrLf & vbCrLf & "My text"
mai.Send
ElseIf mai.forward Then
mai.forward
mai.To = "fred@fred.com"
mai.Send
End If
End If
Set OlkFolder = Nothing
Set olkNS = Nothing
Set olkApp = Nothing
End Sub
Is the checkbox on a form ... and if so what is the form name?
Chris
Chris
ASKER
It is on the form and it is called:
chkPause
Mike
chkPause
Mike
ASKER
Hi Patrick,
InputBox is not ideal. And this is why. When I am looping to reply to 10 emails, for example, I don't want the InputBox poping up. With a check box, it will stop the processing if the usere has checked it to pause.
Mike
InputBox is not ideal. And this is why. When I am looping to reply to 10 emails, for example, I don't want the InputBox poping up. With a check box, it will stop the processing if the usere has checked it to pause.
Mike
Line 18 and Line 22, replace with:
If Me!chkPause Then
mai.Display
Else
mai.Send
End If
If Me!chkPause Then
mai.Display
Else
mai.Send
End If
Something like:
application.Forms("formnam e").Contro ls("ChkPau se").value ?
Chris
application.Forms("formnam
Chris
ASKER
When I used:
DoCmd.SendObject acSendReport, "rErrors_1", acFormatRTF, "SK@Company.com", , strSubject, strMsg, Me!chkPause
In another application with chkPause = True, it opens the email in send mode waiting for the user to add some additional comments before cliking on the Send button. With the above code, the process is not interrupted by Outlook security interface (see below).
With your recent code regardless chkPause is True or False, at
mai.Body = mai.Body & vbCrLf & vbCrLf & "My text"
I get this Outlook security interface (which is no good).
Also when chkPause = True, it just opens the email (it doesn't opens it in send mode).
I was hopping to bypass the Outlook security interface (when chkPause = True) and on top of that to open in send mode ready to take additional comments from user before the send button is clicked.
I hope this makes sence.
Mike
OLK-1.bmp
DoCmd.SendObject acSendReport, "rErrors_1", acFormatRTF, "SK@Company.com", , strSubject, strMsg, Me!chkPause
In another application with chkPause = True, it opens the email in send mode waiting for the user to add some additional comments before cliking on the Send button. With the above code, the process is not interrupted by Outlook security interface (see below).
With your recent code regardless chkPause is True or False, at
mai.Body = mai.Body & vbCrLf & vbCrLf & "My text"
I get this Outlook security interface (which is no good).
Also when chkPause = True, it just opens the email (it doesn't opens it in send mode).
I was hopping to bypass the Outlook security interface (when chkPause = True) and on top of that to open in send mode ready to take additional comments from user before the send button is clicked.
I hope this makes sence.
Mike
OLK-1.bmp
ASKER
re:> I get this Outlook security interface (which is no good).
When chkPause = False, I expect to get this message but I hope there is a way to bypass it when chkPause = True similar to what
DoCmd.SendObject acSendReport, "rErrors_1", acFormatRTF, "SK@Company.com", , strSubject, strMsg, Me!chkPause
does.
Mike
When chkPause = False, I expect to get this message but I hope there is a way to bypass it when chkPause = True similar to what
DoCmd.SendObject acSendReport, "rErrors_1", acFormatRTF, "SK@Company.com", , strSubject, strMsg, Me!chkPause
does.
Mike
ASKER
Here is my final code:
Public Sub SearchForItem(strEntryID As String, strMode As String)
Dim obj_CurrentOlkFolder As Outlook.MAPIFolder
Dim olkApp As Object, _
olkNS As Object, _
OlkFolder As Object, _
olkItem As Object, _
strQuery As String, _
mai As mailitem
Set olkApp = GetObject(, "Outlook.Application")
Set olkNS = olkApp.Session
Set olkItem = olkNS.GetItemFromID(strEntryID)
If olkItem.Class = olMail Then
Set mai = olkItem
If strMode = "Reply" Then
mai.Body = mai.Body & vbCrLf & vbCrLf & "My text"
If Forms!fAPOS!fEmail.Form!chkPause Then
mai.Display
Else
mai.Send
End If
ElseIf strMode = "Forward" Then
mai.forward
mai.To = "MEghtebas@sunamerica.com"
If Forms!fAPOS!fEmail.Form!chkPause Then
mai.Display
Else
mai.Send
End If
Else
olkItem.Display
End If
End If
Set OlkFolder = Nothing
Set olkNS = Nothing
Set olkApp = Nothing
End Sub
ASKER
I should've said, here is my latest code. I don't have the final (acceptable) answere yet.
Mike
Mike
First off I assume you are on outlook 2003. There are ways around the message, but one bridge at a time.
Are you saying you cannot get the correct value for chkpause in your code? I assume Forms!fAPOS!fEmail.Form!ch kPause is equivalent to the application.Forms("formnam e").Contro ls("ChkPau se").value syntax I suggested earlier which ought to work.
But any clarification will help.
In regard to the security warning do you have redemption or mapilab add-ins available on the PC(s)?
Chris
Are you saying you cannot get the correct value for chkpause in your code? I assume Forms!fAPOS!fEmail.Form!ch
But any clarification will help.
In regard to the security warning do you have redemption or mapilab add-ins available on the PC(s)?
Chris
ASKER
- I am using outlook 2003.
- I am getting value for chkpause in the code.
re:> redemption
As you mentioned "one bridge at a time". I will deal with this issue later.
Now, the way my other application works with:
Pauses (no scurity interface):
DoCmd.SendObject acSendReport, "rErrors_1", acFormatRTF, "SK@Company.com", , strSubject, strMsg, True 'Me!chkPause
Doesn't pause but it gives me the attached screen.
DoCmd.SendObject acSendReport, "rErrors_1", acFormatRTF, "SK@Company.com", , strSubject, strMsg, False 'Me!chkPause
I hope this helps.
I am thinking of using ".SendObject acSendReport..." method instead if we cannot find a solution for it using this method.
Thanks,
Mike
OLK-2.bmp
- I am getting value for chkpause in the code.
re:> redemption
As you mentioned "one bridge at a time". I will deal with this issue later.
Now, the way my other application works with:
Pauses (no scurity interface):
DoCmd.SendObject acSendReport, "rErrors_1", acFormatRTF, "SK@Company.com", , strSubject, strMsg, True 'Me!chkPause
Doesn't pause but it gives me the attached screen.
DoCmd.SendObject acSendReport, "rErrors_1", acFormatRTF, "SK@Company.com", , strSubject, strMsg, False 'Me!chkPause
I hope this helps.
I am thinking of using ".SendObject acSendReport..." method instead if we cannot find a solution for it using this method.
Thanks,
Mike
OLK-2.bmp
ASKER
re:> I will deal with this issue later.
I am trying to duplicate the behavior that I have with my other application. Meaning, with chkPause = True, I do not expect any security popup. But, with chkPause = False, it is okay to get one.
Mike
I am trying to duplicate the behavior that I have with my other application. Meaning, with chkPause = True, I do not expect any security popup. But, with chkPause = False, it is okay to get one.
Mike
The other app pauses or not based on chkPause. ChkPAuse is a checkbox on a form.
Other than checking the value something needs to be done to make the pause happen. From what I understand the chkpause works since you get display or send according to it's setting.
Beyond this the security warning is a separate issue so what needs to be fixed bfore we look to the security warning ... or do I misunderstandthe current position?
Chris
Other than checking the value something needs to be done to make the pause happen. From what I understand the chkpause works since you get display or send according to it's setting.
Beyond this the security warning is a separate issue so what needs to be fixed bfore we look to the security warning ... or do I misunderstandthe current position?
Chris
ASKER
re:> The other app pauses or not based on chkPause. ChkPAuse is a checkbox on a form.
Yes, Yes
-------------------------
re:> From what I understand the chkpause works since you get display or send according to it's setting.
With chkpause = True it opens the email. It doesn't open in send mode.
With chkpause = False it presents Outlook Security (the first one) and then sends the email.
Your summation, therefore, is not quite correct.
--------------------
re:> security warning
I will contact you on this part later if it is okay with you (under some new questions).
Thanks,
Mike
Yes, Yes
-------------------------
re:> From what I understand the chkpause works since you get display or send according to it's setting.
With chkpause = True it opens the email. It doesn't open in send mode.
With chkpause = False it presents Outlook Security (the first one) and then sends the email.
Your summation, therefore, is not quite correct.
--------------------
re:> security warning
I will contact you on this part later if it is okay with you (under some new questions).
Thanks,
Mike
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I would either replace mai.Send with mai.Display, or use an InputBox or a Form control to ask for
the additional comments and pop them into mai.Body.
Patrick