A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Way to add prompt to this macro?



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old December 16th 07, 05:54 PM posted to microsoft.public.outlook.program_vba
StargateFan
external usenet poster
 
Posts: 48
Default Way to add prompt to this macro?

Hi! I was given a fantastic script on this board some time back which
I use all the time. It sorts the folders in the main Personal
Folders. This is the script he

************************************************** **************
Private Sub Application_Startup()
ExpandAllFolders
End Sub

Private Sub ExpandAllFolders()
On Error Resume Next
Dim Ns As Outlook.NameSpace
Dim Folders As Outlook.Folders
Dim CurrF As Outlook.MAPIFolder
Dim F As Outlook.MAPIFolder
Dim ExpandDefaultStoreOnly As Boolean

ExpandDefaultStoreOnly = True

Set Ns = Application.GetNamespace("Mapi")
Set CurrF = Application.ActiveExplorer.CurrentFolder

If ExpandDefaultStoreOnly = True Then
Set F = Ns.GetDefaultFolder(olFolderInbox)
Set F = F.Parent
Set Folders = F.Folders
LoopFolders Folders, True

Else
LoopFolders Ns.Folders, True
End If

DoEvents
Set Application.ActiveExplorer.CurrentFolder = CurrF
End Sub
Private Sub LoopFolders(Folders As Outlook.Folders, _
ByVal bRecursive As Boolean _
)
Dim F As Outlook.MAPIFolder

For Each F In Folders
Set Application.ActiveExplorer.CurrentFolder = F
DoEvents

If bRecursive Then
If F.Folders.Count Then
LoopFolders F.Folders, bRecursive
End If
End If
Next
End Sub
************************************************** **************

The thing is that the process takes a bit of time, which is absolutely
no problem. But a lot of times, the folders don't need to be expanded
each and every time O2K is launched and/or I need to get in
immediately.

How can we add a prompt to run this macro rather than having it run
automatically when all macros are enabled, pls?

Thank you! D
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook macro abends but Word macro runs successfully Jreue Outlook and VBA 0 December 14th 06 12:55 AM
Address prompt Lawrence J.Ryz Outlook - Using Contacts 1 October 24th 06 01:09 PM
Call macro stored in Excel workbook from Outlook's macro Gvaram Outlook and VBA 5 October 4th 06 07:26 AM
security prompt Rog Add-ins for Outlook 1 July 13th 06 06:46 AM
Macro to prompt for metadata and them place in the subject line Ben Bazian Outlook and VBA 1 April 12th 06 07:19 AM


All times are GMT +1. The time now is 08:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.