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?
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.

MTroutwineCommented:
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

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
vbWayneAuthor Commented:
Adjusted points to 25
0
vbWayneAuthor Commented:
My inexperience is showing up big time.

Thanks,
Wayne
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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
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
Visual Basic Classic

From novice to tech pro — start learning today.