Can't Enable Macro in Outlook 2003

I have over 100 folders in Outlook 2003. I have a separate folder for every active case file in my law practice, plus a few generic folders for emails that don't relate to any case. I have so many folders that sometimes it's hard to find the folder I'm looking for. For that reason I wanted to be able to SEARCH for a folder BY NAME. I found a macro on a website which supposedly will do this. The code is:

Option Explicit
Option Compare Text

Sub FindFolders()
Dim SearchString As String
SearchString = InputBox("Enter a Folder name substring")
If SearchString <> "" Then
Dim Note As NoteItem
Set Note = CreateItem(olNoteItem)
ProcessFolder Session.Folders.GetFirst, SearchString, Note
Note.Width = 800
Note.Display
End If
End Sub

Function GetPath(Folder As Outlook.MAPIFolder) As String
On Error GoTo Finally
GetPath = GetPath(Folder.Parent) + "/" + Folder.Name
Exit Function
Finally:
GetPath = "/" + Folder.Name
End Function

Sub ProcessFolder(CurrentFolder As Outlook.MAPIFolder, SearchString As String, Note As NoteItem)
If InStr(CurrentFolder.Name, SearchString) > 0 Then
Note.Body = Note.Body + GetPath(CurrentFolder) + Chr(10)
End If
Dim olNewFolder As Outlook.MAPIFolder
For Each olNewFolder In CurrentFolder.Folders
ProcessFolder olNewFolder, SearchString, Note
Next
End Sub

In Outlook 2003, I went to TOOLS, MACRO, VISUAL BASIC EDITOR and pasted in this code to create the macro. This presents three problems:

1. Pasting in this code, the first two lines ("Option Explicit" and "Option Compare Text") associate themselves with the previous macro, not the one I was trying to create. I eventually just deleted these two lines.

2. The VBA editor seems to see this as three macros, not one. it inserts horizontal lines between them, as it would between separate macros.

3. IT WON'T RUN. No matter what I do, I get the error "The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros." I've tried setting macro security to "LOW" but that didn't help. I tired creating my own digital certificate using this mehod:

a. Create a digital certificate for yourself. In Windows XP: Start, All Programs, Microsoft Office Tools, Digital Certificate for VBA Projects. Follow the instructions to create a certificate.

b. Sign the Macro. In Outlook: Tools, Macro, Visual Basic Editor. In the Project Explorer, select the project you want to sign. Click Tools, Digital Signature. Click Choose, select the certificate, click OK twice. Save.

c. When you open or run the macro, you will get a security warning. Check "Always trust macros from this source."

This didn't help either. I do not get a security warning giving me the opportunity to "trust" macros from this source. It just tells me that macros are disabled.
GrayStricklandAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SriVaddadiCommented:
Where did you paste the code? Follow these steps

Press Alt+F11 on the outlook and that opens the Visual Basic Editor

On the left, project explorer tab, you see project1 Under that Microsoft Outlook folder and under that ThisOutlookSession.

Double click the "ThisOutlookSession" and paste the code. Just Press F5 you should be all set without making any changes
0
Chris BottomleySoftware Quality Lead EngineerCommented:
First off where are you pasting the code ... thisOutlookSession?
0
Chris BottomleySoftware Quality Lead EngineerCommented:
Try pasting into a new module

Alt + F11 to open the macro editor

     Insert | Module to insert a code module into the project
     In the project tree select the module.
     Insert the required macro(s) into the selected module, ('Module1' or similar)


Check Security as appropriate:
------------------------------

In the application select Tools | Macro | Security
2003 and Earlier : Select Medium
2007 : Warnings for all Macros
Select OK

To run a macro:
---------------

Alt + F8
Select the macro
Select 'Run'

Chris
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Chris BottomleySoftware Quality Lead EngineerCommented:
Note, the code is in fact three macros:

FindFolders - the real macro and two help functions:
GetPath & ProcessFolder

The editor will see them correctly as three routines hence the seperator

Chris
0
Chris BottomleySoftware Quality Lead EngineerCommented:
IN regard to security try closing and re-opening outlook after setting the enable security.

Chris
0
Rooker33Commented:
Problem #3:
Solving problem #3 is the first order of business, you need to get macros running. Setting the Macro security level to low should do the trick as Microsoft's site says "macros are automatically enabled" with the low setting (http://office.microsoft.com/en-us/outlook/HP052850551033.aspx .)  
It seems this is not working for you, but just to verify. you are using the Outlook Tools | Macro | Security menu item and you are able to select 'Low' as the macro security level?  After selecting a new level, you should make sure to shutdown Outlook and then restart for the setting to take effect. (If you haven't tried restarting and this was your problem then I do recommend setting to Medium rather than low and using your  self-signed macros.)

Problem #1:
I recommend creating a new module in the VBA Project for this macro ...
Open VBA and right click on Project1, then select "Insert | module", this should create an empty module for you to paste the above code into so that it does not interfere with any of your other existing macros.

Problem #2:
There are 3 'routines' which is probably confusing you, the actual macro to run is the first routine 'Find Folders' the other 2 routines are simply helper routines that are only meant to be called from the main macro routine, not run by you.

0
Chris BottomleySoftware Quality Lead EngineerCommented:
Note you want one copy of the macros so move them to the new module rather than copy them.  ALso to test the start up add a macro to thisoutlooksession as:

Once it's working you can delete it.

Chris

Alt + F11 to open the macro editor

  For Applicationevent handlers:
     In the project tree select as appropriate:
      OUTLOOK      : thisOutlookSession
     In the workpane select as appropriate:
      OUTLOOK      : Application
     In the workpane select the required 'event', (i.e. 'Application_Startup").
     Either
        Insert the required code from the supplied sub into the selected subroutine.
     Or
        Replace the template inserted by the VBE with the sub as supplied

Private Sub Application_Startup()
    msgbox("MAcros Enabled")
end sub

Open in new window

0
GrayStricklandAuthor Commented:
NOTE:  the macro code which is listed now runs, but does not do what is expected. Troubleshooting the actual macro code is outside the scope of this thread, so I'll start a new one. The macro asks me for a search string to find a folder. When I supply that, instead of finding the folder, it opens a NOTE (memo) for editing. Weird.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.