Outlook Folder

Increaded to 25 for working answer

I use this function I found on the net to open my mail (Outlook98) in the InBox.
However, it opens half screen..anyone know how to adjust it to have it open the folder maximized?'open folder in outlook

Public Function OpenFolder(FldrName As String)
    Dim olApp As New Outlook.Application
    Dim nsMAPI As Outlook.NameSpace
    Set nsMAPI = olApp.GetNamespace("MAPI")
    Dim d As Long
    For d = 1 To nsMAPI.Folders.Count
        Dim p
        For p = 1 To nsMAPI.Folders.Item(d).Folders.Count
            If nsMAPI.Folders.Item(d).Folders.Item(p).Name = FldrName Then
 nsMAPI.Folders.Item(d).Folders.Item(p).Display
                Exit Function
                End If
            Next p
        Next d
End Function

'thanks,
'Wayne


LVL 1
vbWayneAsked:
Who is Participating?
 
MTroutwineConnect With a Mentor Commented:
Here is your code but I added one like after you do the display.  This will cause Outlook to appear maximized.

Public Function OpenFolder(FldrName As String)
    Dim olApp As New Outlook.Application
    Dim nsMAPI As Outlook.NameSpace
    Set nsMAPI = olApp.GetNamespace("MAPI")
    Dim d As Long
    For d = 1 To nsMAPI.Folders.Count
        Dim p
        For p = 1 To nsMAPI.Folders.Item(d).Folders.Count
            If nsMAPI.Folders.Item(d).Folders.Item(p).Name = FldrName Then
 nsMAPI.Folders.Item(d).Folders.Item(p).Display
                 olApp.ActiveWindow.WindowState = olMaximized
                Exit Function
                End If
            Next p
        Next d
   
   
End Function

:>)
0
 
vbWayneAuthor Commented:
Adjusted points to 25
0
 
vbWayneAuthor Commented:
My inexperience is showing up big time.

Thanks,
Wayne
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
vbWayneAuthor Commented:
My inexperience is showing up big time.

Thanks,
Wayne
0
 
vbWayneAuthor Commented:
My inexperience is showing up big time.

Thanks,
Wayne
0
 
vbWayneAuthor Commented:
Even more...
Your code doesn't work..olApp.ActiveWindow.WindowState = olMaximized

it says olMaximized variable not declared
If i try vbMaximized or 3 it says it doesn't support this property..

Help
               

0
 
MTroutwineCommented:
vbWayne,

Sorry for the delay in responding, doing the weekend thing.  The code works fine for me, I will try it on my test machine and see what it does!  Be back shortly...




0
 
vbWayneAuthor Commented:
No problem...thanks for staying connected..
Actually when I do the ActiveWindow.
and the box opens with all the possibilities...there is no window state.

Later

Not urgent...it's the weekend...enjoy
0
 
MTroutwineCommented:
I apoligize, I tested this without thinking my workstation is running Outlook 2000.  As soon as I tried this on my test machine, running Outlook 98 it bombed out.  Shouldn't be a problem to fix though.  Actually WindowState doesn't appear in Outlook 2000 either, kind of funny actually.

Thanks!
0
 
vbWayneAuthor Commented:
OK.
out of curiosity, where are you located...it's 6:08pm here and your posting says 2:02pm. Ontario, Canada here or is it just the clocks on this site out of whack.

0
 
MTroutwineCommented:
The locks are kind of whack 'o on the site.  I am located on the Iowa/Illnois border in the US.  I am on the Iowa side, but Illinois is 10 minutes away!
0
 
MTroutwineCommented:
Well not so good news here.  After not being able to get this to work, I called a friend who's sole  purpose in lief is Office development.  He informed me that until Outlook 2000, WindowState and the ability to control Minimize, Maximize and Restore of an Outlook window programatically was not supported.  He pointed me to this article which covers the new properties, methods, etc. covered in Outlook 2000.  

http://msdn.microsoft.com/library/techart/o2kwhatsnew.htm

If you look under properties you will find WindowState as a new property.  

I would be more than glad to contact the folks at EE to get your points back to you.

:>)
0
 
vbWayneAuthor Commented:
Don't worry about the points, you earned them...my question has been answered (just can't be done)...
......thanks for the above and beyond the call of duty reply.

Wayne
0
All Courses

From novice to tech pro — start learning today.