• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 714
  • Last Modified:

opening outlook calendar from access form

I'm no longer going to preface questions with "is it possible" - cuz I now know that almost anything is!! what I need to know now is how complicated would it be to open ms outlook directly to the calendar from a command button on an access form; and, would this be possible on a multi-user (splid) database environment where it would be difficult to modify each user's version of access or outlook (supplying files would not be hard because i have front-end updater software that could deliver it... but modifying settings within office apps would not be so practical) thanks!!
0
jpomerantz
Asked:
jpomerantz
  • 5
  • 5
2 Solutions
 
David LeeCommented:
Hi, jpomerantz.

It's not hard at all.  The code below opens the default calendar.  Add the code to a button's click event and you should be in business.
Const olFolderCalendar = 9
Dim olkApp, olkSes, olkFolder
On Error Resume Next
Set olkApp = GetObject(,"Outlook.Application")
If TypeName(olkApp) = "Nothing" Then
	Set olkApp = CreateObject("Outlook.Application")
	Set olkSes = olkApp.GetNameSpace("MAPI")
	'Change Outlook on the next line to the name of the default mail profile'
	olkSes.Logon "Outlook"
Else
	Set olkSes = olkApp.Session
End If
Set olkFolder = olkSes.GetDefaultFolder(olFolderCalendar)
olkFolder.Display
Set olkApp = Nothing
Set olkSes = Nothing
Set olkFolder = Nothing

Open in new window

0
 
jpomerantzAuthor Commented:
WOW!! that is so cool :) I can't thank you enough!!! for some reason though, it opens the calendar - but only if outlook is already open. if outlook is not open, nothing happens.  is there something to add to it to get it to first open outlook?
0
 
David LeeCommented:
I included code to open Outlook if it isn't already open.  That's the code between the IF and ELSE.  Did you change the profile per the comment in the code?  Your profile may not be called Outlook.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jpomerantzAuthor Commented:
I didn't change anything in it - just cut and pasted it... I'm sort of a newbie and don't know about profiles... how do I know what my profile is? I do know that the school has it's own exchange server - I remote in using a vpn but most users will be on the network in the building... is there a way to figure out what the profile should be?
thank you so much!!
0
 
David LeeCommented:
Here's how to check your profile name.

1.  Open the control panel
2.  Double-click the Mail icon
3.  Click the Show Profiles button
4.  Look at the "Always use this profile" selection at the bottom.  The name you see there is the name of the default profile.  It's typically "Outlook", but could be soemthing different.
0
 
jpomerantzAuthor Commented:
sure enough, the profile does say outlook... I wonder what is going on. I tried this on two computers and it's the same thing: if outlook is open already, the code opens the calendar - but if it's not - nothing happens.  any ideas?
I really appreciate this!!
0
 
David LeeCommented:
Replace line #5 with the line below

If TypeName(olkApp) <> "Application" Then
0
 
jpomerantzAuthor Commented:
Works perfectly now!!! thank you so so so much :-)
0
 
jpomerantzAuthor Commented:
that did it! I can't thank you enough :-)
0
 
David LeeCommented:
You're welcome.  Glad I could help!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now