Program not working for public account in Outlook.

  • Thread starter Thread starter joshnya2
  • Start date Start date
J

joshnya2

I created a program that works fine when I am using my own personal
Exchange profile in
Outlook. It creates a series of appointments on my calendar and then
invites people that are pulled from a custom form.

When I switch over to a public account I have full access to and run
the
program I get "Operation aborted (Exception from HRESULT: 0x80004004
(E_ABORT))"

The error is indicating I have an issue with this line of code:

objAppt = objOL.CreateItem(olAppointmentItem)


I have had several people at my office look at this and all are
baffled. Any
clues/ideas/suggestions are very welcome. Thanks!

If requested I will post the entire code.
 
You are missing a Set statement with that line of code, but I don't imagine
that your problem will be solved that easily!

What exactly do you mean by a "public" account? Also, go ahead and post
your full code.
 
By public I mean it is a dummy Outlook account that is used as a
"centralized" calendar for team tasks/schedules. There are 10 people
with full access to this account. My program places an appointment on
the default calendar then sends invites to certain people based upon
what was entered in my custom form. If I have *MY* account/calendar up
the program works perfectly. If I create a profile and log into
Outlook as the *other* account the program halts on the line of code I
indicated.

My code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim StartTime As ValueType
Dim EndTime As ValueType
StartTime = DateTimePicker1.Value
EndTime = DateTimePicker1.Value.AddHours(9)
Dim objOL 'As Outlook.Application
Dim objAppt 'As Outlook.AppointmentItem
Const olAppointmentItem = 1
Const olMeeting = 1

objOL = CreateObject("Outlook.Application")
objAppt = objOL.CreateItem(olAppointmentItem)

'If ListBox1.SelectedItem = ("") Then
' MsgBox("Please select a team member for Remedy RC Bucket,
Thanks.")
'ElseIf ListBox2.SelectedItem = ("") Then
' MsgBox("Please select a team member for Inbox, Thanks.")
'ElseIf ListBox3.SelectedItem = ("") Then
' MsgBox("Please select a team member for Remedy IS/MIIS
Buckets, Thanks.")
'ElseIf ListBox4.SelectedItem = ("") Then
' MsgBox("Please select a team member for Triage, Thanks.")
'Else

Dim Counter As Integer
Counter = 0

'shortName(ListBox5)
'With objAppt
' .Subject = (Label9.Text)
' .start = StartTime
' .End = DateTimePicker1.Value.AddDays(5)
' .Location = displayName
' .AllDayEvent = True



' ' make it a meeting request
' .MeetingStatus = olMeeting
' .RequiredAttendees = ListBox5.Text
' .Send()
'End With

'Do While Counter < 2

'This is the appointment for the first task
shortName(ListBox1)

With objAppt
.Subject = (Label1.Text)
.start = StartTime
.End = EndTime
.Location = displayName
'.AllDayEvent = True

' make it a meeting request
.MeetingStatus = olMeeting
.RequiredAttendees = ListBox1.Text
.Send()

End With

Thanks for any time/effort spent on my behalf. This was my first time
working with VBScript and it's been interesting to say the least :p
 
For some reason I think you are loading another mailbox in your Outlook
profile and trying to programmatically create an Appointment item in the
Calendar stored in that mailbox. In those cases, you need to get that folder
by using the GetDefaultSharedFolder method and use the Items.Add method to
create a new item in that folder.

But - if you aren't doing that - the only thing I can think of is that you
don't have permissions on that Calendar. Can you create items there manually?
 
I have full control over the shared calendar.

How would the structure work then to set the appointment on the shared
folder?

I am guessing I have to "load" the shared folder then start adding
items to it?

Thanks again!
 
Here's a sample from the Outlook VBA Help file. Again, this only applies if
you've loaded another mailbox in your profile.

Sub ResolveName()
Dim myOlApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myRecipient As Outlook.Recipient
Dim CalendarFolder As Outlook.MAPIFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myRecipient = myNamespace.CreateRecipient("Dan Wilson")
myRecipient.Resolve
If myRecipient.Resolved Then
Call ShowCalendar(myNamespace, myRecipient)
End If
End Sub

Sub ShowCalendar(myNamespace, myRecipient)
Dim CalendarFolder As Outlook.MAPIFolder
Set CalendarFolder = _
myNamespace.GetSharedDefaultFolder _
(myRecipient, olFolderCalendar)
CalendarFolder.Display
End Sub
 
Back
Top