Skip to main content

Conas fillteán (cosán fillteáin iomlán) a fháil de réir ainm an fhillteáin in Outlook?

Mar shampla, ar phána Nascleanúna bogann tú fillteán agus titeann tú chuig fillteán anaithnid trí dhearmad in Outlook, ba mhaith leat an fillteán seo a chur ar ais ach ní féidir leat é a fháil amach láithreach. Ar an drochuair, ní thacaíonn Outlook leis an Aimsigh gné chéanna leis an gceann i Microsoft Word nó Excel. Ná bí buartha! Féadfaidh tú macra VBA a chur i bhfeidhm chun an fhadhb seo a réiteach in Outlook.

Cuardaigh go tapa agus fillteáin a oscailt de réir ainm an fhillteáin le huirlis iontach

Go ginearálta, is féidir linn fillteáin a chuardach de réir ainm fillteáin le cód VBA. Is féidir leis an gcuid is mó de chód VBA fillteáin a chuardach sa bhosca poist reatha, agus an chéad fhillteán aimsithe amháin a oscailt. Anois leis an ngné Go To de Kutools for Outlook, is féidir leat fillteáin de réir ainm an fhillteáin a fháil go héasca, agus aon duine de na fillteáin aimsithe a oscailt de réir mar is gá duit.



Faigh fillteán (cosán fillteáin iomlán) de réir ainm an fhillteáin le VBA

Lean na céimeanna thíos le do thoil chun fillteáin a chuardach de réir ainmneacha fillteán le VBA in Outlook.

1. Brúigh Eile + F11 eochracha le chéile chun an fhuinneog Microsoft Visual Basic for Applications a oscailt.

2. Cliceáil Ionsáigh > Modúil, agus ansin greamaigh faoi bhun chód VBA isteach i bhfuinneog nua an Mhodúil.

VBA: Cuardaigh agus oscail fillteáin de réir ainm an fhillteáin in Outlook

Private m_Folder As MAPIFolder
Private m_Find As String
Private m_Wildcard As Boolean

Private Const SpeedUp As Boolean = True
Private Const StopAtFirstMatch As Boolean = True

Public Sub FindFolder()
Dim sName As String
Dim oFolders As Folders

  Set m_Folder = Nothing
m_Find = ""
m_Wildcard = False

  sName = InputBox("Find:", "Search folder")
If Len(Trim(sName)) = 0 Then Exit Sub
m_Find = sName

  m_Find = LCase(m_Find)
m_Find = Replace(m_Find, "%", "*")
m_Wildcard = (InStr(m_Find, "*"))

  Set oFolders = Application.Session.Folders
LoopFolders oFolders

  If Not m_Folder Is Nothing Then
If MsgBox("Activate folder: " & vbCrLf & m_Folder.FolderPath, vbQuestion Or vbYesNo) = vbYes Then
Set Application.ActiveExplorer.CurrentFolder = m_Folder
End If
Else
MsgBox "Not found", vbInformation
End If
End Sub

Private Sub LoopFolders(Folders As Outlook.Folders)
Dim oFolder As MAPIFolder
Dim bFound As Boolean

If SpeedUp = False Then DoEvents

  For Each oFolder In Folders
If m_Wildcard Then
bFound = (LCase(oFolder.Name) Like m_Find)
Else
bFound = (LCase(oFolder.Name) = m_Find)
End If

    If bFound Then
If StopAtFirstMatch = False Then
If MsgBox("Found: " & vbCrLf & oFolder.FolderPath & vbCrLf & vbCrLf & "Continue?", vbQuestion Or vbYesNo) = vbYes Then
bFound = False
End If
End If
End If
If bFound Then
Set m_Folder = oFolder
Exit For
Else
LoopFolders oFolder.Folders
If Not m_Folder Is Nothing Then Exit For
End If
Next
End Sub

3. Brúigh F5 eochair nó cliceáil ar an Rith cnaipe chun an VBA seo a rith.

4. Sa bhosca dialóige fillteán Cuardaigh popping amach, clóscríobh ainm an fhillteáin shonraithe a ndéanfaidh tú cuardach air, agus cliceáil ar an OK cnaipe. Féach an pictiúr:

nótaí: Tacaíonn an VBA seo le cárta fiáin réiltín. Mar shampla, is féidir leat clóscríobh tes * chun gach fillteán a dtosaíonn a ainm a fháil amach tes.

5. Anois tagann bosca dialóige amach agus taispeánann sé cosán fillteán an fhillteáin aimsithe. Más gá duit an fillteán aimsithe a oscailt, cliceáil ar an Is ea cnaipe.

Agus anois tá an fillteán aimsithe ag oscailt ar an bpána Nascleanúna mar atá thíos an pictiúr a thaispeántar:

nótaí: Má tá níos mó ná fillteán amháin ainmnithe leis an ainm sonraithe, ní féidir leis an VBA seo ach fillteán amháin a aimsiú agus a oscailt.


Cuardaigh fillteán de réir ainm fillteáin le huirlis iontach

Má tá Kutools for Outlook suiteáilte agat, is féidir leat a ghné Go To a chur i bhfeidhm chun gach fillteán faoi ainm fillteáin áirithe a fháil amach go tapa, agus fillteáin a aimsítear go héasca a oscailt d’aon duine freisin.

Kutools le haghaidh Outlook: Supercharge Outlook le níos mó ná 100 uirlisí nach mór a bheith acu. Déan tástáil air SAOR IN AISCE ar feadh 60 lá, gan aon teaghráin ceangailte!   Leigh Nios mo...   Íosluchtaigh Anois!

1. Cliceáil Kutools Plus > Téigh go chun an ghné seo a chumasú.

2. Sa dialóg Téigh Chun, clóscríobh ainm an fhillteáin shonraithe sa Cuardaigh bosca, roghnaigh fillteán sna torthaí cuardaigh, agus cliceáil ar an Ok cnaipe.

Anois tá an fillteán sonraithe a bhfuil ainm áirithe an fhillteáin air le fáil agus á oscailt láithreach.


Earraí gaolmhara:


Uirlisí Táirgiúlachta Oifige is Fearr

Kutools le haghaidh Outlook - Níos mó ná 100 Gnéithe cumhachtacha chun do Outlook a shárú

🤖 Cúntóir Ríomhphoist AI: Ríomhphoist pro toirt le draíocht AI - aon-cliceáil chun freagraí genius, ton foirfe, máistreacht ilteangach. Trasfhoirmigh ríomhphost gan stró! ...

📧 Uathoibriú Ríomhphoist: As Oifig (Ar fáil do POP agus IMAP)  /  Sceideal Seol Ríomhphoist  /  Auto CC/BCC de réir Rialacha Agus Ríomhphost á Sheoladh  /  Auto Ar Aghaidh (Ardrialacha)   /  Beannacht Auto Cuir leis   /  Scoilt Ríomhphoist Ilfhaighteoirí go huathoibríoch i dTeachtaireachtaí Aonair ...

📨 Bainistíocht Ríomhphost: Ríomhphoist a Athghairm go héasca  /  Bloc Ríomhphoist Scam ag Ábhair agus Daoine Eile  /  Scrios Ríomhphoist Dúblacha  /  Cuardach Casta  /  Comhdhlúthaigh Fillteáin ...

📁 Ceangaltáin ProSábháil Baisc  /  Baisc Dícheangail  /  Comhbhrú Baisc  /  Auto Sábháil   /  Auto Dícheangail  /  Comhbhrúite Auto ...

🌟 Draíocht Chomhéadain: 😊Níos mó Emojis Pretty and Cool   /  Treisiú Do Tháirgiúlacht Outlook le Radhairc Tabbed  /  Íoslaghdaigh Outlook In ionad Deiridh ...

???? Wonders aon-cliceáil: Freagair Gach Duine le Ceangaltáin Isteach  /   Ríomhphoist Frith-Iascaireachta  /  🕘 Taispeáin Crios Ama an tSeoltóra ...

👩🏼‍🤝‍👩🏻 Teagmhálaithe & Féilire: Baisc Cuir Teagmhálacha Ó Ríomhphoist Roghnaithe  /  Roinn Grúpa Teagmhála ar Ghrúpaí Aonair  /  Bain Meabhrúcháin Breithlá ...

Thar Gnéithe 100 Fan le do Thaiscéalaíocht! Cliceáil Anseo le Tuilleadh Amach.

 

 

Comments (10)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thank you for this great macro. I have used it extensively over the past 2 years. My employer switched from Office 16 to Office 365 and since then, this macro is VERY slow. Is there any way to optimize it for Office 365?
Thanks!
This comment was minimized by the moderator on the site
This macro has really helped me is incredible, thank you!!!
Is it possible to to go to the next occurrence, so instead of just Yes/No have something as Yes/Next/No ?
Thank you
This comment was minimized by the moderator on the site
Private m_Folder As MAPIFolder
Private m_Find As String
Private m_Wildcard As Boolean

Private Const SpeedUp As Boolean = True
'Private Const StopAtFirstMatch As Boolean = True
Private StopAtFirstMatch As Boolean

Public Sub FindFolder()
Dim sName As String
Dim oFolders As Folders

Set m_Folder = Nothing
m_Find = ""
m_Wildcard = False

sName = InputBox("Find:", "Search folder")
If Len(Trim(sName)) = 0 Then Exit Sub

'm_Find = sName
' Added "*"... for any given string in the folder name
m_Find = "*" & sName & "*"

m_Find = LCase(m_Find)
m_Find = Replace(m_Find, "%", "*")
m_Wildcard = (InStr(m_Find, "*"))

' Set oFolders = Application.Session.Folders
Set oFolders = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders

LoopFolders oFolders

If Not m_Folder Is Nothing Then
' Removed - If MsgBox("Activate folder: " & vbCrLf & m_Folder.FolderPath, vbQuestion Or vbYesNo) = vbYes Then
Set Application.ActiveExplorer.CurrentFolder = m_Folder
Else
MsgBox "Search End...", vbInformation
End If
End Sub

Private Sub LoopFolders(Folders As Outlook.Folders)
Dim oFolder As MAPIFolder
Dim bFound As Boolean

If SpeedUp = False Then DoEvents

For Each oFolder In Folders
If m_Wildcard Then
bFound = (LCase(oFolder.Name) Like m_Find)
Else
bFound = (LCase(oFolder.Name) = m_Find)
End If


If bFound Then
If StopAtFirstMatch = False Then
Set Application.ActiveExplorer.CurrentFolder = oFolder

If MsgBox("Found: " & vbCrLf & oFolder.FolderPath & vbCrLf & vbCrLf & "Search for next?", vbQuestion Or vbYesNo) = vbYes Then
bFound = False
End If
Else
MsgBox ("Not found")
End If
End If
If bFound Then
Set m_Folder = oFolder
Exit For
Else
LoopFolders oFolder.Folders
If Not m_Folder Is Nothing Then Exit For
End If
Next
End Sub
This comment was minimized by the moderator on the site
Hi, if i try to copy and past the macro yes/next/no, I only received the message "Search End".
Could you take a look? I would really appreciate it. Thanks
This comment was minimized by the moderator on the site
Hi, if i try to copy and past the macro yes/next/no, I only received the message "Search End".Could you take a look? I would really appreciate it. Thanks
This comment was minimized by the moderator on the site
Wow this is exactly. I really appreciate it and you did it so fast.Thanks
This comment was minimized by the moderator on the site
Hello,

Thank you for this macro. It works great!


Is there a way to make the macro always search as wildcards? I would be easier to just type a keyword without adding the asterisks every time.
This comment was minimized by the moderator on the site
Replace Line 18 with

m_Find = "*" & sName & "*"
This comment was minimized by the moderator on the site
Replace Line 18 with
m_Find = "*" & sName & "*"
This comment was minimized by the moderator on the site
Hello.

Wow - this is an amazing function, which will make my daily usage of Outlook tons faster.
Thank you so much for publishing!!

A tip for those interested:
If you want to search only INBOX-folders, without public folders etc.
This made it a lot faster for me because the public folder are remote, so the search is quite slow.
And also I'm not interested in those results.


Replace line 24 with:

Set oFolders = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations