RecurrenceState (need help)

M

Moe

Hi, I am using the following codes to generate the appointment on a
shared calender. I am having the problem with .RecurrenceState. I want
it to recure daily from Start Date till End Date.

Can somebody help me out please.

THanks

Moe
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objDummy As Outlook.MailItem
Dim objRecip As Outlook.Recipient
Dim objAppt As Outlook.AppointmentItem
Dim strMsg As String
Dim strName As String
On Error Resume Next

' ### name of person whose Calendar you want to use ###
strName = "TORO Assessments"

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objDummy = objApp.CreateItem(olMailItem)
Set objRecip = objDummy.Recipients.Add(strName)
objRecip.Resolve
If objRecip.Resolved Then
On Error Resume Next
Set objFolder = _
objNS.GetSharedDefaultFolder(objRecip, _
olFolderCalendar)
If Not objFolder Is Nothing Then
Set objAppt = objFolder.Items.Add
If Not objAppt Is Nothing Then
With objAppt
Dim strSubject As String

If Nz(Me.cboTesterName) <> "" Then
strSubject = "(" & GetAbbrevs(Me.cboTesterName.Column(1)) & ")"
Else
strSubject = ""
End If

.Subject = strSubject & Me.SYS_NME
'Me.SYS_NME & vbNullString
.Start = Me.TEST_BEGIN_DATE
'CDate(Me.TEST_BEGIN_DATE)
.Body = Me.SYS_NOTES
.Recipients = "Faisal Askari"
.End = Me.TEST_END_DATE
'.Duration = Me.txtDuration
'CDate(Me.TEST_END_DATE)
.AllDayEvent = False

.Save
End With
End If
End If
Else
MsgBox "Could not find " & Chr(34) & strName & Chr(34), , _
"User not found"
End If

Set objApp = Nothing
Set objNS = Nothing
Set objFolder = Nothing
Set objDummy = Nothing
Set objRecip = Nothing
Set objAppt = Nothing
 
B

Brian Tillman

Moe said:
Hi, I am using the following codes to generate the appointment on a
shared calender. I am having the problem with .RecurrenceState. I want
it to recure daily from Start Date till End Date.

Can somebody help me out please.

The people in the correct newsgroup can do that.
news://msnews.microsoft.com/microsoft.public.outlook.program_vba
 
M

Moe

i thought this is a Outlook group and i thought my question is a
typical Outlook question.

Thanks anyway
 
M

Moe

I tried to change the code but its not doing anything with Recurrence.
Its just simply putting the appointments on the calender with no
Recurrence.

Can someone help me out please

Thanks

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objDummy As Outlook.MailItem
Dim objRecip As Outlook.Recipient
Dim objAppt As Outlook.AppointmentItem
Dim strMsg As String
Dim strName As String
Dim myDate As Date
Dim myException As Outlook.Exception
Dim myRecurrPatt As Outlook.RecurrencePattern

On Error Resume Next

strName = "Assessments"

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objDummy = objApp.CreateItem(olMailItem)
Set objRecip = objDummy.Recipients.Add(strName)
Set myRecurrPatt = objApp.GetRecurrencePattern
objRecip.Resolve
If objRecip.Resolved Then
On Error Resume Next
Set objFolder = _
objNS.GetSharedDefaultFolder(objRecip, _
olFolderCalendar)
If Not objFolder Is Nothing Then
Set objAppt = objFolder.Items.Add
'objAppt.GetRecurrencePattern.GetOccurence
If Not objAppt Is Nothing Then
With objAppt
Dim strSubject As String

If Nz(Me.cboTesterName) <> "" Then
strSubject = "(" &
GetAbbrevs(Me.cboTesterName.Column(1)) & ")"
Else
strSubject = ""
End If


myRecurrPatt.PatternStartTime = Me.TEST_BEGIN_DATE
myRecurrPatt.PatternEndTime = Me.TEST_END_DATE
myRecurrPatt.PatternRecurrenceType = olRecursDaily
'objAppt.GetRecurrencePattern.GetOccurence
.Subject = strSubject & Me.SYS_NME
.Start = Me.TEST_BEGIN_DATE
.Body = Me.SYS_NOTES
.Recipients = "Mike Burge"
.End = Me.TEST_END_DATE
.Save
End With
End If
End If
Else
MsgBox "Could not find " & Chr(34) & strName & Chr(34), , _
"User not found"
End If

Set objApp = Nothing
Set objNS = Nothing
Set objFolder = Nothing
Set objDummy = Nothing
Set objRecip = Nothing
Set objAppt = Nothing
 
K

Ken Slovak - [MVP - Outlook]

This is an Outlook user interface group. The group Brian pointed you to is
for VBA programming questions and is where the Outlook developers hang out.
You're far more likely to get a dev to notice your programming questions in
a programming group.
 
K

Ken Slovak - [MVP - Outlook]

Where is this code running? What version of Outlook?

Outlook.Application has no RecurrencePattern property and that's what you're
trying to get. Appointment items and Task items have a RecurrencePattern
property.
 
B

Brian Tillman

Moe said:
i thought this is a Outlook group and i thought my question is a
typical Outlook question.

This is a group for questions about the Outlook Calendar user interface.
 
M

Moe

Thanks both of you guys, i was not sure. But may be u can answer this
one, we have a shared calender in our team and the above codes i
developed to create appointments from MS Access to that calender. Do
you think i can create a continues connection with MS Access and that
shared calender so if someone change something dates, it automatically
changes in MS Access database?

Thanks again guys.

Moe
 
K

Ken Slovak - [MVP - Outlook]

You can certainly handle changes to items in a folder, using ItemChange of
the folder's Items collection. Whether or not your code keeps a connection
open to the database or closes it and opens a new connection on changes is
up to you and your setup and various database concerns. That's not really an
Outlook thing.

BTW, it makes it a lot easier for those of us that answer a lot of posts if
you put part of the preceding thread, at least the preceding message in your
posts. That way we don't have to go show all posts to figure out what the
poster is talking about.
 

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