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

Making an apt into a public calendar



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 9th 06, 04:35 PM posted to microsoft.public.outlook.program_vba
SAC
external usenet poster
 
Posts: 5
Default Making an apt into a public calendar

Sorry, I'm new at this.....

I am programming MS Access can can make an outlook apt in the local
calendar, but I'd like to make an apt to the shared or public folder. How
do I specify in in which calendar I want the apt to be made?

Here's the code I use for the local computer:

On Error GoTo Add_Err
Dim intI As Integer
Dim dteStart As Date
Dim dteStop As Date
Dim intCounter As Integer
Dim intNoDays As Integer
dteStart = strStart
dteStop = strStop

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

'Add a new appointment.
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

.Categories = "SHOWS"
.AllDayEvent = True
'.Start = Me!ApptDate & " " & Me!ApptTime
.Start = strStart '& " 08:00 AM" 'Me!CallBack & " " & "09:00 AM"

'.End = strStop
'.Duration = Me!ApptLength
'.Subject = strSubject '"Call " & Me!Name & "-Prospect"
.Subject = strSubject
'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 = #7/9/2003#
' 'You could get these values
' 'from new text boxes on the form.
' .PatternEndDate = #7/23/2003#
'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 Function

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


Thanks!


  #2  
Old February 9th 06, 04:42 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Making an apt into a public calendar

To create an item in a particular folder, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Appointment.YourFormNa me")

optionally passing the name of a published form as the parameter.

To get a non-default folder, you need to walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm and, especially for public folders, http://www.outlookcode.com/codedetail.aspx?id=1164
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"SAC" wrote in message ...
Sorry, I'm new at this.....

I am programming MS Access can can make an outlook apt in the local
calendar, but I'd like to make an apt to the shared or public folder. How
do I specify in in which calendar I want the apt to be made?

Here's the code I use for the local computer:

On Error GoTo Add_Err
Dim intI As Integer
Dim dteStart As Date
Dim dteStop As Date
Dim intCounter As Integer
Dim intNoDays As Integer
dteStart = strStart
dteStop = strStop

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

'Add a new appointment.
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

.Categories = "SHOWS"
.AllDayEvent = True
'.Start = Me!ApptDate & " " & Me!ApptTime
.Start = strStart '& " 08:00 AM" 'Me!CallBack & " " & "09:00 AM"

'.End = strStop
'.Duration = Me!ApptLength
'.Subject = strSubject '"Call " & Me!Name & "-Prospect"
.Subject = strSubject
'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 = #7/9/2003#
' 'You could get these values
' 'from new text boxes on the form.
' .PatternEndDate = #7/23/2003#
'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 Function

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


Thanks!


 




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
Outlook 2002 appointment sent to public folder calendar gets puts in someone elses calendar instead QH Outlook - Calandaring 4 February 24th 06 05:14 PM
Making a form work in calendar view Hugh Outlook - Using Forms 0 January 30th 06 10:39 AM
Making contacts in public folder the default for "New Contacts"? Jarvster Outlook - Using Contacts 1 January 27th 06 03:53 PM
Making work week the default calendar view GVarner Outlook - Calandaring 1 January 27th 06 11:48 AM
Making the Public Folder Contacts the Primary Contacts?? Roman B. Outlook - Using Contacts 1 January 9th 06 10:52 AM


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


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.