Stumped withOpen Outlook Calendar onundrum

J

J.J.

I do not believe there is an item value to open the calendar in Outlook much
like
"Set objItem = spObj.CreateItem(olAppointmentItem)" opens the apointment
page etc. As an alternative I triedadapted another piece of code I found:
Sub Command20_Click()
On Error GoTo Command20_Error
Dim oApp As Object, oFolder As Object
Set oApp = CreateObject("Outlook.Application")
Set oFolder = oApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar)
oFolder.Display
Set oFolder = Nothing
Exit Sub
Command20_Error:
MsgBox "Error: " & Err & " " & Error
End Sub
This code runs fine on my test mdb but when I bring it over to the
production mdb which is on the same machine by the way, I get "error 5
invalid procedure call or argument." I can't replicate the problem in the
test enviroment.
Any ideas
 
J

J.J.

Hi Alex,

Sorry, I am not sure what you mean by "try to use value 9 instead of
constant olFolderCalendar. Then you can also remove reference from outlook
object library."
I am not a coder, so I ask you to please be a little more explicit.
Thank you so much again! - must've been more frustrated last evening as
subject line should've read Conundrum.
 
D

Douglas J. Steele

Alex was suggesting using

Set oFolder = oApp.GetNamespace("MAPI").GetDefaultFolder(9)
 
D

Danny Lesandrini

Seems to me that the original poster said it worked on one machine, but not the other.
Could that because Outlook isn't installed on that machine? Could it be because it's
not configured for the user?

Just a thought.
 
D

Douglas J. Steele

If Outlook wasn't installed on the second machine, you'd get an Error 429
when trying to instantiate it.

Outlook not being configured correctly could certainly be an issue. Afraid I
haven't worked much with Outlook lately, so I'm not sure what steps would be
needed to rectify that. It might be worth J.J.'s while to post to the
Outlook newsgroup.
 
J

J.J.

Thank you Both Douglas ,Alex and Danny

Alex, thank you for pinpointing the problem. Douglas for clarifying. In
response to Danny's question, please note that I indicated that both programs
were running on the same machine but thank you just the same for looking at
problem.
Hurray, it now works perfectly.
Again, thank you so much for helping out. All you guys make this such a
great site. It is very much appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top