Set appointment location

  • Thread starter Thread starter nyisonkennedy
  • Start date Start date
N

nyisonkennedy

I have a macro that creates a new appointment from e-mails that I get. I am
trying to add some new functionality that will search the e-mail for a string
("KCC" or"PCC") and if the it finds that string set the location of the
appointment to that string. Please advise.

Regards

~N
 
Please advise what?

If you want to know how to search the body of the email then if the email is
oMail and the appointment is oAppt then:

If (Instr(1, oMail.Body, "KCC") > 0) Then
oAppt.Location = "KCC"
ElseIf (Instr(1, oMail.Body, "PCC") > 0) Then
oAppt.Location = "PCC"
End If

Of course you have to save the appointment after changing it.
 
Actually, I have another question. How would I create a statement to search
the body of the email for both "KCC" and "PCC". If both exist in the message
then set the location to "KCC and PCC".

Regards;

~N
 
If ((Instr(1, oMail.Body, "KCC") > 0) And (Instr(1, oMail.Body, "PCC") >
0))Then
oAppt.Location = "KCC and PCC"
ElseIf (Instr(1, oMail.Body, "KCC") > 0) Then
oAppt.Location = "KCC"
ElseIf (Instr(1, oMail.Body, "PCC") > 0) Then
oAppt.Location = "PCC"
End If
 
Thank You!

Ken Slovak - said:
If ((Instr(1, oMail.Body, "KCC") > 0) And (Instr(1, oMail.Body, "PCC") >
0))Then
oAppt.Location = "KCC and PCC"
ElseIf (Instr(1, oMail.Body, "KCC") > 0) Then
oAppt.Location = "KCC"
ElseIf (Instr(1, oMail.Body, "PCC") > 0) Then
oAppt.Location = "PCC"
End If
 
Back
Top