create a macro to open public folder?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Regularly, I have to drill down through 4 folders to reach the public c
alendar. How EXACTLY (spell it out please!) do I create a macro to do this
with one keystroke combo?
 
Private Sub cmdLink_Click()

Dim myExplorer As Object
Dim myNameSpace As Outlook.NameSpace
Dim myFolder, myFolder1, myFolder2, myFolder3, myFolder4 As
Outlook.MAPIFolder
Dim myFolders As Outlook.Folders
Set myNameSpace = Application.GetNamespace("MAPI")

Set myFolders = myNameSpace.Folders("Public Folders").Folders
For Each myFolder In myFolders
If myFolder.name = "All Public Folders" Then
For Each myFolder1 In myFolder.Folders
If myFolder1.name = "PT" Then
For Each myFolder2 In myFolder1.Folders
If myFolder2.name = "Help Desk Application" Then
For Each myFolder3 In myFolder2.Folders
If myFolder3.name = "PTHelp" Then
frmnovoAHT.Hide
Set myExplorer = myFolder3.GetExplorer
myExplorer.Activate
Call myFolder3.Display
Exit Sub
End If
Next
End If
Next
End If
Next
End If
Next
End Sub
 
In VBE (ALT+F11), insert> module, then insert>procedure and paste the code
you can then create a function to call the procedure, and voila.
 
Get an INVALID PROCEDURE name message - I'm saying
"open calendar" (no quotes) What do I do EXACTLY? Thanks.
 
Hi,
The code posted starts with "Private Sub cmdLink_Click()" which means you
need to click a button on your form to run the code.
I'm assuming you don't have a form. So it won't work.
 
Back
Top