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

"special" recuring appointment...



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 8th 09, 04:23 AM posted to microsoft.public.outlook.program_vba
Duncan McC
external usenet poster
 
Posts: 56
Default "special" recuring appointment...

Hi,

I found some code in this group that I'd like to use and modify to
create a recurring appointment, for:
* the 2nd Tuesday of every month, plus one day.

(This is to remind me to check server's n' stuff for MS monthly
updates).

In New Zealand though (17hrs ahead of the US approx), creating an
appointment for the 2nd *Wednesday* of every month, simply doesn't work
on a surprisingly often basis (eg. have a look at this month (April)).

So I want to create a recurring appointment for the 2nd Tuesday of every
month, plus one day (ie the next day after that).

Can the code below be mod'd to make this a go'er?

Private Sub cmdAddAppt_Click()
On Error GoTo Add_Err

'Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord

'Exit the procedure if appointment has been added to
Outlook.
If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft
Outlook"
Exit Sub
'Add a new appointment.
Else
Dim objOutlook As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim objRecurPattern As Outlook.RecurrencePattern

Set objOutlook = CreateObject("Outlook.Application")

Set objAppt = objOutlook.CreateItem(olAppointmentItem)

With objAppt
.Start = Me!ApptStartDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.Subject = Me!Appt

If Not IsNull(Me!ApptNotes) Then .Body = Me!
ApptNotes
If Not IsNull(Me!ApptLocation) Then .Location =
Me!ApptLocation
If Me!ApptReminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If

Set objRecurPattern = .GetRecurrencePattern

With objRecurPattern
.RecurrenceType = olRecursWeekly
.Interval = 1
'Once per week
' .PatternStartDate = #12/19/2003#
.PatternStartDate = Me!ApptStartDate
'You could get these values
'from new text boxes on the form.
' .PatternEndDate = #7/23/2003#
.PatternEndDate = Me!ApptEndDate
End With

.Save
.Close (olSave)
End With
'Release the AppointmentItem object variable.
Set objAppt = Nothing
End If

'Release the Outlook object variable.
Set objOutlook = Nothing

'Set the AddedToOutlook flag, save the record, display a
message.
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"

Exit Sub

Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub

End Sub

--
Duncan
Ads
  #2  
Old April 8th 09, 09:02 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default "special" recuring appointment...



I'd use the UI to create one appointment, then access it by code, and see
the values of the properties.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 8 Apr 2009 15:23:38 +1200 schrieb Duncan McC:

Hi,

I found some code in this group that I'd like to use and modify to
create a recurring appointment, for:
* the 2nd Tuesday of every month, plus one day.

(This is to remind me to check server's n' stuff for MS monthly
updates).

In New Zealand though (17hrs ahead of the US approx), creating an
appointment for the 2nd *Wednesday* of every month, simply doesn't work
on a surprisingly often basis (eg. have a look at this month (April)).

So I want to create a recurring appointment for the 2nd Tuesday of every
month, plus one day (ie the next day after that).

Can the code below be mod'd to make this a go'er?

Private Sub cmdAddAppt_Click()
On Error GoTo Add_Err

'Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord

'Exit the procedure if appointment has been added to
Outlook.
If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft
Outlook"
Exit Sub
'Add a new appointment.
Else
Dim objOutlook As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim objRecurPattern As Outlook.RecurrencePattern

Set objOutlook = CreateObject("Outlook.Application")

Set objAppt = objOutlook.CreateItem(olAppointmentItem)

With objAppt
.Start = Me!ApptStartDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.Subject = Me!Appt

If Not IsNull(Me!ApptNotes) Then .Body = Me!
ApptNotes
If Not IsNull(Me!ApptLocation) Then .Location =
Me!ApptLocation
If Me!ApptReminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If

Set objRecurPattern = .GetRecurrencePattern

With objRecurPattern
.RecurrenceType = olRecursWeekly
.Interval = 1
'Once per week
' .PatternStartDate = #12/19/2003#
.PatternStartDate = Me!ApptStartDate
'You could get these values
'from new text boxes on the form.
' .PatternEndDate = #7/23/2003#
.PatternEndDate = Me!ApptEndDate
End With

.Save
.Close (olSave)
End With
'Release the AppointmentItem object variable.
Set objAppt = Nothing
End If

'Release the Outlook object variable.
Set objOutlook = Nothing

'Set the AddedToOutlook flag, save the record, display a
message.
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"

Exit Sub

Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub

End Sub

  #3  
Old April 9th 09, 12:29 AM posted to microsoft.public.outlook.program_vba
Duncan McC
external usenet poster
 
Posts: 56
Default "special" recuring appointment...

Cheers Michael,

What is the line of code I need to access an appointment, say titled
"test001"?

TIA


--
Duncan

In article ,
says...


I'd use the UI to create one appointment, then access it by code, and see
the values of the properties.


  #4  
Old April 9th 09, 07:44 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default "special" recuring appointment...



If it's the current open item, you can access it this way:
Dim Appt as Outlook.AppointmentItem
Set Appt=Application.ActiveInspector.CurrentItem

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Thu, 9 Apr 2009 11:29:44 +1200 schrieb Duncan McC:

Cheers Michael,

What is the line of code I need to access an appointment, say titled
"test001"?

TIA

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
How do I delete a calendar that is called a "special folder" tweedy48 Outlook - Calandaring 2 September 21st 08 02:50 AM
Appointment "Catagory " is lost when accepting an appointment invi Ralph Malph Outlook - Calandaring 4 July 2nd 08 07:15 PM
Custom colums for "Inbox", "Contacts", and "Calandar" rcf Outlook - Installation 0 February 15th 08 10:31 PM
How to print appointment times in "Weekly" or "Monthly" print styles? Alan Outlook - General Queries 0 September 27th 06 07:47 AM
Include "Telecommuting" or "Teleworking" as a "Show time as" statu Gordon Greene Outlook - Calandaring 0 July 31st 06 03:37 PM


All times are GMT +1. The time now is 02:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.