G
Guest
Hi!, i need to do filters with VBA, but, i need to do how is the better wway
to do that.
i do this code on the bottom. Its Work, but, where for example the emails
adress is the second email addres for To field, is a problem. And for
example, many emails the TO filed is just the first word of the email address
(wwp) and no the entire address.
how i do it???? can you tell me??
Thanks a lot.
Ruben
Public Sub CustomFilters(ItemEmail As MailItem, ObjElistas As Object,
TotalItems As Integer)
Dim str As String
Dim Lcibernautas As Outlook.MAPIFolder
Set Lcibernautas = ObjElistas.Folders.Item("Cibernaut@s")
Dim Ljavascript As Outlook.MAPIFolder
Set Ljavascript = ObjElistas.Folders.Item("javascript")
Dim Lvsayuda As Outlook.MAPIFolder
Set Lvsayuda = ObjElistas.Folders.Item("vsayuda")
Dim Ltrucostecnicos As Outlook.MAPIFolder
Set Ltrucostecnicos = ObjElistas.Folders.Item("trucostecnicos")
Dim Llwp As Outlook.MAPIFolder
Set Llwp = ObjElistas.Folders.Item("lwp")
Dim LMundoPc As Outlook.MAPIFolder
Set LMundoPc = ObjElistas.Folders.Item("MundoPc")
Dim Lwwp As Outlook.MAPIFolder
Set Lwwp = ObjElistas.Folders.Item("wwp")
Dim SendTo As String
SendTo = ItemEmail.To
Select Case SendTo
Case "(e-mail address removed)"
ItemEmail.Move Lcibernautas
Case "(e-mail address removed)"
ItemEmail.Move Ljavascript
Case "(e-mail address removed)"
ItemEmail.Move Lvsayuda
Case "vsayuda"
ItemEmail.Move Lvsayuda
Case "(e-mail address removed)"
ItemEmail.Move Ltrucostecnicos
Case "lwp"
ItemEmail.Move Llwp
Case "(e-mail address removed)"
ItemEmail.Move Llwp
Case "(e-mail address removed)"
ItemEmail.Move LMundoPc
Case "(e-mail address removed)"
ItemEmail.Move Lwwp
End Select
totalprocess = totalprocess + 1
str = "[" & totalprocess & "/" & TotalItems & "] " & ItemEmail.Subject
CountOfItems.Caption = str
PBarItems.Value = totalprocess
DoEvents
If (totalprocess = TotalItems) Then
Set Lcibernautas = Nothing
Set Ljavascript = Nothing
Set Lvsayuda = Nothing
End If
End Sub
to do that.
i do this code on the bottom. Its Work, but, where for example the emails
adress is the second email addres for To field, is a problem. And for
example, many emails the TO filed is just the first word of the email address
(wwp) and no the entire address.
how i do it???? can you tell me??
Thanks a lot.
Ruben
Public Sub CustomFilters(ItemEmail As MailItem, ObjElistas As Object,
TotalItems As Integer)
Dim str As String
Dim Lcibernautas As Outlook.MAPIFolder
Set Lcibernautas = ObjElistas.Folders.Item("Cibernaut@s")
Dim Ljavascript As Outlook.MAPIFolder
Set Ljavascript = ObjElistas.Folders.Item("javascript")
Dim Lvsayuda As Outlook.MAPIFolder
Set Lvsayuda = ObjElistas.Folders.Item("vsayuda")
Dim Ltrucostecnicos As Outlook.MAPIFolder
Set Ltrucostecnicos = ObjElistas.Folders.Item("trucostecnicos")
Dim Llwp As Outlook.MAPIFolder
Set Llwp = ObjElistas.Folders.Item("lwp")
Dim LMundoPc As Outlook.MAPIFolder
Set LMundoPc = ObjElistas.Folders.Item("MundoPc")
Dim Lwwp As Outlook.MAPIFolder
Set Lwwp = ObjElistas.Folders.Item("wwp")
Dim SendTo As String
SendTo = ItemEmail.To
Select Case SendTo
Case "(e-mail address removed)"
ItemEmail.Move Lcibernautas
Case "(e-mail address removed)"
ItemEmail.Move Ljavascript
Case "(e-mail address removed)"
ItemEmail.Move Lvsayuda
Case "vsayuda"
ItemEmail.Move Lvsayuda
Case "(e-mail address removed)"
ItemEmail.Move Ltrucostecnicos
Case "lwp"
ItemEmail.Move Llwp
Case "(e-mail address removed)"
ItemEmail.Move Llwp
Case "(e-mail address removed)"
ItemEmail.Move LMundoPc
Case "(e-mail address removed)"
ItemEmail.Move Lwwp
End Select
totalprocess = totalprocess + 1
str = "[" & totalprocess & "/" & TotalItems & "] " & ItemEmail.Subject
CountOfItems.Caption = str
PBarItems.Value = totalprocess
DoEvents
If (totalprocess = TotalItems) Then
Set Lcibernautas = Nothing
Set Ljavascript = Nothing
Set Lvsayuda = Nothing
End If
End Sub