A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , , ,

Error when creating 247 appointments in exchange mailbox





 
 
Thread Tools Display Modes
  #1  
Old November 4th 07, 02:06 PM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default Error when creating 247 appointments in exchange mailbox

Hello,

I try to create hundreds of appointments in the calendar with a link
to a contact.

This works without problems on pst stores. With exchange mailboxes it
works too in OL 2003 but in 2002 on the 247th item the following error
occurs:

run time error -284147707 (ef104005)
error when executing the operation

This message is translated from German because I have no English 2002.
The numbers are different from time to time. In the compiled add-in I
get the message "-2147467259: Automation Error Unknown Error".

Here is the used code:

Sub Test()
Call CreateAppointments(1, 230)
Call CreateAppointments(231, 500)
End Sub

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objCalendar As Outlook.MAPIFolder
Dim objContacts As Outlook.Items

Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

For lngIndex = lngFrom To lngTo
Set objApp = objCalendar.Items.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Next

End Sub

The error occurs on the line "Call .Links.Add(objContacts(lngIndex))"
and if I press after the error message F5 the code will run for the
next 246 items and will stop then again. Without the Link.Add method
the code runs without any errors.

Maybe this is an Outlook bug, but may be some one knows a workarround.

Thanks for any help and/or suggestions.

Peter

Ads
  #2  
Old November 5th 07, 07:00 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,264
Default Error when creating 247 appointments in exchange mailbox



Peter, do you know for sure that there's no Distlist in the contacts folder?
Then I'd use a variable for the ContactItem because accessing objContacts(i)
twice creates two references.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Synchronize Color Categories & Ensure that Every Item Gets Categorized:
http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6

Am Sun, 04 Nov 2007 05:06:59 -0800 schrieb Peter Marchert:

Hello,

I try to create hundreds of appointments in the calendar with a link
to a contact.

This works without problems on pst stores. With exchange mailboxes it
works too in OL 2003 but in 2002 on the 247th item the following error
occurs:

run time error -284147707 (ef104005)
error when executing the operation

This message is translated from German because I have no English 2002.
The numbers are different from time to time. In the compiled add-in I
get the message "-2147467259: Automation Error Unknown Error".

Here is the used code:

Sub Test()
Call CreateAppointments(1, 230)
Call CreateAppointments(231, 500)
End Sub

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objCalendar As Outlook.MAPIFolder
Dim objContacts As Outlook.Items

Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

For lngIndex = lngFrom To lngTo
Set objApp = objCalendar.Items.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Next

End Sub

The error occurs on the line "Call .Links.Add(objContacts(lngIndex))"
and if I press after the error message F5 the code will run for the
next 246 items and will stop then again. Without the Link.Add method
the code runs without any errors.

Maybe this is an Outlook bug, but may be some one knows a workarround.

Thanks for any help and/or suggestions.

Peter

  #3  
Old November 5th 07, 07:24 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 1,592
Default Error when creating 247 appointments in exchange mailbox

You are running out of 255 open messages limit imposed by Exchange in the
online mode.
Do not use multiple dot notation (to avoid implicit variables created by the
compiler) and immediately release all COM objects after using them:

set objItems = objCalendar.Items
For lngIndex = lngFrom To lngTo
Set objApp = objItems .Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Marchert" wrote in message
oups.com...
Hello,

I try to create hundreds of appointments in the calendar with a link
to a contact.

This works without problems on pst stores. With exchange mailboxes it
works too in OL 2003 but in 2002 on the 247th item the following error
occurs:

run time error -284147707 (ef104005)
error when executing the operation

This message is translated from German because I have no English 2002.
The numbers are different from time to time. In the compiled add-in I
get the message "-2147467259: Automation Error Unknown Error".

Here is the used code:

Sub Test()
Call CreateAppointments(1, 230)
Call CreateAppointments(231, 500)
End Sub

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objCalendar As Outlook.MAPIFolder
Dim objContacts As Outlook.Items

Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)

For lngIndex = lngFrom To lngTo
Set objApp = objCalendar.Items.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Next

End Sub

The error occurs on the line "Call .Links.Add(objContacts(lngIndex))"
and if I press after the error message F5 the code will run for the
next 246 items and will stop then again. Without the Link.Add method
the code runs without any errors.

Maybe this is an Outlook bug, but may be some one knows a workarround.

Thanks for any help and/or suggestions.

Peter



  #4  
Old November 5th 07, 08:05 AM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default Error when creating 247 appointments in exchange mailbox

On 5 Nov., 07:00, "Michael Bauer [MVP - Outlook]"
wrote:
Peter, do you know for sure that there's no Distlist in the contacts folder?
Then I'd use a variable for the ContactItem because accessing objContacts(i)
twice creates two references.


Moin, Michael,

thanks for your assistance. The used contact folder does not contain
distlists only testing contacts.

Peter

  #5  
Old November 5th 07, 08:07 AM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default Error when creating 247 appointments in exchange mailbox

Thanks for your reply, Dmitry.

I change my code to:

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objAppointments As Outlook.Items
Dim objContacts As Outlook.Items
Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objAppointments =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items

For lngIndex = lngFrom To lngTo
Set objApp = objAppointments.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next

End Sub

But that makes no difference. What else could be the problem? Please
remember that the code works without the line
"Call .Links.Add(objContacts(lngIndex))". Can it even be the 255 items
problem?

Peter

On 5 Nov., 07:24, "Dmitry Streblechenko" wrote:
You are running out of 255 open messages limit imposed by Exchange in the
online mode.
Do not use multiple dot notation (to avoid implicit variables created by the
compiler) and immediately release all COM objects after using them:

set objItems = objCalendar.Items
For lngIndex = lngFrom To lngTo
Set objApp = objItems .Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Marchert" wrote in message

oups.com...



Hello,


I try to create hundreds of appointments in the calendar with a link
to a contact.


This works without problems on pst stores. With exchange mailboxes it
works too in OL 2003 but in 2002 on the 247th item the following error
occurs:


run time error -284147707 (ef104005)
error when executing the operation


This message is translated from German because I have no English 2002.
The numbers are different from time to time. In the compiled add-in I
get the message "-2147467259: Automation Error Unknown Error".


Here is the used code:


Sub Test()
Call CreateAppointments(1, 230)
Call CreateAppointments(231, 500)
End Sub


Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)


Dim objCalendar As Outlook.MAPIFolder
Dim objContacts As Outlook.Items


Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long


Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)


For lngIndex = lngFrom To lngTo
Set objApp = objCalendar.Items.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Next


End Sub


The error occurs on the line "Call .Links.Add(objContacts(lngIndex))"
and if I press after the error message F5 the code will run for the
next 246 items and will stop then again. Without the Link.Add method
the code runs without any errors.


Maybe this is an Outlook bug, but may be some one knows a workarround.


Thanks for any help and/or suggestions.


Peter- Zitierten Text ausblenden -


- Zitierten Text anzeigen -



  #6  
Old November 5th 07, 02:47 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Error when creating 247 appointments in exchange mailbox

Try explicitly returning objContacts(lngIndex) so you can explicitly release it:

Set objContact = objContacts(lngIndex)
.Subject = objContact
Call .Links.Add(objContact)
Set objContact = Nothing

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Peter Marchert" wrote in message ups.com...
Thanks for your reply, Dmitry.

I change my code to:

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objAppointments As Outlook.Items
Dim objContacts As Outlook.Items
Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objAppointments =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items

For lngIndex = lngFrom To lngTo
Set objApp = objAppointments.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next

End Sub

But that makes no difference. What else could be the problem? Please
remember that the code works without the line
"Call .Links.Add(objContacts(lngIndex))". Can it even be the 255 items
problem?

Peter

On 5 Nov., 07:24, "Dmitry Streblechenko" wrote:
You are running out of 255 open messages limit imposed by Exchange in the
online mode.
Do not use multiple dot notation (to avoid implicit variables created by the
compiler) and immediately release all COM objects after using them:

set objItems = objCalendar.Items
For lngIndex = lngFrom To lngTo
Set objApp = objItems .Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Marchert" wrote in message

oups.com...



Hello,


I try to create hundreds of appointments in the calendar with a link
to a contact.


This works without problems on pst stores. With exchange mailboxes it
works too in OL 2003 but in 2002 on the 247th item the following error
occurs:


run time error -284147707 (ef104005)
error when executing the operation


This message is translated from German because I have no English 2002.
The numbers are different from time to time. In the compiled add-in I
get the message "-2147467259: Automation Error Unknown Error".


Here is the used code:


Sub Test()
Call CreateAppointments(1, 230)
Call CreateAppointments(231, 500)
End Sub


Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)


Dim objCalendar As Outlook.MAPIFolder
Dim objContacts As Outlook.Items


Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long


Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)


For lngIndex = lngFrom To lngTo
Set objApp = objCalendar.Items.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Next


End Sub


The error occurs on the line "Call ..Links.Add(objContacts(lngIndex))"
and if I press after the error message F5 the code will run for the
next 246 items and will stop then again. Without the Link.Add method
the code runs without any errors.


Maybe this is an Outlook bug, but may be some one knows a workarround.


Thanks for any help and/or suggestions.


Peter- Zitierten Text ausblenden -


- Zitierten Text anzeigen -



  #7  
Old November 5th 07, 05:33 PM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default Error when creating 247 appointments in exchange mailbox

Thanks Sue,

I tried it hopefully but it does not solve the problem:

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objAppointments As Outlook.Items
Dim objContacts As Outlook.Items
Dim objContact As Outlook.ContactItem
Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objAppointments =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items

For lngIndex = lngFrom To lngTo
Set objContact = objContacts(lngIndex)
Set objApp = objAppointments.Add
With objApp
.ReminderSet = False
.Start = objContact.Birthday
.Subject = objContact.Subject
Call .Links.Add(objContact)
.Save
End With
Set objApp = Nothing
Set objContact = Nothing
Next

End Sub

I´m testing in virtual machines - may be this could be a problem? Does
the code runs on your machine (OL 2002/Exchange 2003)?

Here some code to create testing contacts:

Sub CreateContacts()

Dim objFolder As Outlook.MAPIFolder
Dim objContact As Outlook.ContactItem
Dim lngItem As Long

Set objFolder = Outlook.ActiveExplorer.CurrentFolder

For lngItem = 1 To 500

Set objContact = Outlook.CreateItem(olContactItem)

With objContact
.FirstName = "Test"
.LastName = lngItem
.Save
End With

Set objContact = Nothing

Next

Set objFolder = Nothing

End Sub

Peter

On 5 Nov., 14:47, "Sue Mosher [MVP-Outlook]"
wrote:
Try explicitly returning objContacts(lngIndex) so you can explicitly release it:

Set objContact = objContacts(lngIndex)
.Subject = objContact
Call .Links.Add(objContact)
Set objContact = Nothing

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54



"Peter Marchert" wrote in oglegroups.com...
Thanks for your reply, Dmitry.


I change my code to:


Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)


Dim objAppointments As Outlook.Items
Dim objContacts As Outlook.Items
Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long


Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objAppointments =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items


For lngIndex = lngFrom To lngTo
Set objApp = objAppointments.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next


End Sub


But that makes no difference. What else could be the problem? Please
remember that the code works without the line
"Call .Links.Add(objContacts(lngIndex))". Can it even be the 255 items
problem?


Peter


On 5 Nov., 07:24, "Dmitry Streblechenko" wrote:
You are running out of 255 open messages limit imposed by Exchange in the
online mode.
Do not use multiple dot notation (to avoid implicit variables created by the
compiler) and immediately release all COM objects after using them:


set objItems = objCalendar.Items
For lngIndex = lngFrom To lngTo
Set objApp = objItems .Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next


Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Peter Marchert" wrote in message


groups.com...


Hello,


I try to create hundreds of appointments in the calendar with a link
to a contact.


This works without problems on pst stores. With exchange mailboxes it
works too in OL 2003 but in 2002 on the 247th item the following error
occurs:


run time error -284147707 (ef104005)
error when executing the operation


This message is translated from German because I have no English 2002.
The numbers are different from time to time. In the compiled add-in I
get the message "-2147467259: Automation Error Unknown Error".


Here is the used code:


Sub Test()
Call CreateAppointments(1, 230)
Call CreateAppointments(231, 500)
End Sub


Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)


Dim objCalendar As Outlook.MAPIFolder
Dim objContacts As Outlook.Items


Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long


Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)


For lngIndex = lngFrom To lngTo
Set objApp = objCalendar.Items.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Next


End Sub


The error occurs on the line "Call .Links.Add(objContacts(lngIndex))"
and if I press after the error message F5 the code will run for the
next 246 items and will stop then again. Without the Link.Add method
the code runs without any errors.


Maybe this is an Outlook bug, but may be some one knows a workarround.


Thanks for any help and/or suggestions.


Peter- Zitierten Text ausblenden -


- Zitierten Text anzeigen -- Zitierten Text ausblenden -


- Zitierten Text anzeigen -



  #8  
Old November 5th 07, 06:12 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 1,592
Default Error when creating 247 appointments in exchange mailbox

You are still using multiple dot notation (.Links.Add)
What happens if you comment out that line?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Marchert" wrote in message
ps.com...
Thanks Sue,

I tried it hopefully but it does not solve the problem:

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objAppointments As Outlook.Items
Dim objContacts As Outlook.Items
Dim objContact As Outlook.ContactItem
Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objAppointments =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items

For lngIndex = lngFrom To lngTo
Set objContact = objContacts(lngIndex)
Set objApp = objAppointments.Add
With objApp
.ReminderSet = False
.Start = objContact.Birthday
.Subject = objContact.Subject
Call .Links.Add(objContact)
.Save
End With
Set objApp = Nothing
Set objContact = Nothing
Next

End Sub

I´m testing in virtual machines - may be this could be a problem? Does
the code runs on your machine (OL 2002/Exchange 2003)?

Here some code to create testing contacts:

Sub CreateContacts()

Dim objFolder As Outlook.MAPIFolder
Dim objContact As Outlook.ContactItem
Dim lngItem As Long

Set objFolder = Outlook.ActiveExplorer.CurrentFolder

For lngItem = 1 To 500

Set objContact = Outlook.CreateItem(olContactItem)

With objContact
.FirstName = "Test"
.LastName = lngItem
.Save
End With

Set objContact = Nothing

Next

Set objFolder = Nothing

End Sub

Peter

On 5 Nov., 14:47, "Sue Mosher [MVP-Outlook]"
wrote:
Try explicitly returning objContacts(lngIndex) so you can explicitly
release it:

Set objContact = objContacts(lngIndex)
.Subject = objContact
Call .Links.Add(objContact)
Set objContact = Nothing

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54



"Peter Marchert" wrote in
oglegroups.com...
Thanks for your reply, Dmitry.


I change my code to:


Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)


Dim objAppointments As Outlook.Items
Dim objContacts As Outlook.Items
Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long


Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objAppointments =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items


For lngIndex = lngFrom To lngTo
Set objApp = objAppointments.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next


End Sub


But that makes no difference. What else could be the problem? Please
remember that the code works without the line
"Call .Links.Add(objContacts(lngIndex))". Can it even be the 255 items
problem?


Peter


On 5 Nov., 07:24, "Dmitry Streblechenko" wrote:
You are running out of 255 open messages limit imposed by Exchange in
the
online mode.
Do not use multiple dot notation (to avoid implicit variables created
by the
compiler) and immediately release all COM objects after using them:


set objItems = objCalendar.Items
For lngIndex = lngFrom To lngTo
Set objApp = objItems .Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Set objApp = Nothing
Next


Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Peter Marchert" wrote in message


groups.com...


Hello,


I try to create hundreds of appointments in the calendar with a link
to a contact.


This works without problems on pst stores. With exchange mailboxes it
works too in OL 2003 but in 2002 on the 247th item the following
error
occurs:


run time error -284147707 (ef104005)
error when executing the operation


This message is translated from German because I have no English
2002.
The numbers are different from time to time. In the compiled add-in I
get the message "-2147467259: Automation Error Unknown Error".


Here is the used code:


Sub Test()
Call CreateAppointments(1, 230)
Call CreateAppointments(231, 500)
End Sub


Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)


Dim objCalendar As Outlook.MAPIFolder
Dim objContacts As Outlook.Items


Dim objApp As Outlook.AppointmentItem
Dim lngIndex As Long


Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objCalendar =
Outlook.Session.GetDefaultFolder(olFolderCalendar)


For lngIndex = lngFrom To lngTo
Set objApp = objCalendar.Items.Add
With objApp
.ReminderSet = False
.Subject = objContacts(lngIndex).Subject
Call .Links.Add(objContacts(lngIndex))
.Save
End With
Next


End Sub


The error occurs on the line "Call .Links.Add(objContacts(lngIndex))"
and if I press after the error message F5 the code will run for the
next 246 items and will stop then again. Without the Link.Add method
the code runs without any errors.


Maybe this is an Outlook bug, but may be some one knows a
workarround.


Thanks for any help and/or suggestions.


Peter- Zitierten Text ausblenden -


- Zitierten Text anzeigen -- Zitierten Text ausblenden -


- Zitierten Text anzeigen -




  #9  
Old November 5th 07, 08:37 PM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default Error when creating 247 appointments in exchange mailbox

On 5 Nov., 18:12, "Dmitry Streblechenko" wrote:
You are still using multiple dot notation (.Links.Add)
What happens if you comment out that line?


If the line is commented out the code works fine. I tried this one:

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objAppointments As Outlook.Items
Dim objContacts As Outlook.Items
Dim objContact As Outlook.ContactItem
Dim objApp As Outlook.AppointmentItem
Dim colLinks As Outlook.Links
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objAppointments =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items

For lngIndex = lngFrom To lngTo
Set objContact = objContacts(lngIndex)
Set objApp = objAppointments.Add
Set colLinks = objApp.Links
With objApp
.ReminderSet = False
.Subject = objContact.Subject
Call colLinks.Add(objContact)
.Save
End With
Set colLinks = Nothing
Set objApp = Nothing
Set objContact = Nothing
Next

End Sub

But the error comes back.

Peter

  #10  
Old November 5th 07, 09:57 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 1,592
Default Error when creating 247 appointments in exchange mailbox

Links.Add returns a Link object, which your code does not reference and
hence cannot release:

set Link = .Links.Add ...
set Link = Nothing

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Marchert" wrote in message
ps.com...
On 5 Nov., 18:12, "Dmitry Streblechenko" wrote:
You are still using multiple dot notation (.Links.Add)
What happens if you comment out that line?


If the line is commented out the code works fine. I tried this one:

Sub CreateAppointments(ByVal lngFrom As Long, ByVal lngTo As Long)

Dim objAppointments As Outlook.Items
Dim objContacts As Outlook.Items
Dim objContact As Outlook.ContactItem
Dim objApp As Outlook.AppointmentItem
Dim colLinks As Outlook.Links
Dim lngIndex As Long

Set objContacts =
Outlook.Session.GetDefaultFolder(olFolderContacts) .Items
Set objAppointments =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items

For lngIndex = lngFrom To lngTo
Set objContact = objContacts(lngIndex)
Set objApp = objAppointments.Add
Set colLinks = objApp.Links
With objApp
.ReminderSet = False
.Subject = objContact.Subject
Call colLinks.Add(objContact)
.Save
End With
Set colLinks = Nothing
Set objApp = Nothing
Set objContact = Nothing
Next

End Sub

But the error comes back.

Peter



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007/Exchange 2003 error when creating multiple items Tadwick Outlook and VBA 7 February 23rd 07 07:33 PM
Creating Mailbox Top Level Folder with VBA Boy from Oz Outlook and VBA 2 November 24th 06 08:05 AM
Permission error when creating rule in your own mailbox? MC Outlook - Installation 6 June 28th 06 04:02 PM
Creating a Calendar in Exchange 5.5 Public Folders...Rights error. Chris Stephens Outlook - Calandaring 1 May 4th 06 03:32 PM
Exchange Mailbox server prohibit from sending when reach mailbox size limit Milly Staples [MVP - Outlook] Outlook - General Queries 1 February 24th 06 07:41 PM


All times are GMT +1. The time now is 06:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Loans - Share Prices - Credit Card Application - Credit Cards UK - Personal Finance