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

setting appt in multiple Outlook Calendars from Access



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 19th 08, 07:26 PM posted to microsoft.public.outlook.program_vba
Paul Access VBA[_2_]
external usenet poster
 
Posts: 2
Default setting appt in multiple Outlook Calendars from Access

Hi, I am using vba with Access 2007 to add appointments to an Outlook 2007
Calendar. This is working fine when I add the appointment to the main
Outlook calendar. However, I have 4 different calendars in the one Outlook,
and I want to be able to choose which outlook calendar I add the appointment
to. Can you tell me how to choose which calendar the appointment will go to?
thanks for your help! (If this isn't the correct forum for this, please let
me know which one is) thanks-Paul

The code I'm using currently is below.

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![Date to Arrive] & " " & #9:00:00 AM#
..Duration = 1920
..Subject = Me.Last__First
..body = Me!Notes
End With
Set objAppt = Nothing
End If
Me!AddedToOutlook = True

MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
Ads
  #2  
Old May 19th 08, 07:39 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default setting appt in multiple Outlook Calendars from Access


Use the target folder's Items.Add function.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Mon, 19 May 2008 10:26:02 -0700 schrieb Paul Access VBA:

Hi, I am using vba with Access 2007 to add appointments to an Outlook 2007
Calendar. This is working fine when I add the appointment to the main
Outlook calendar. However, I have 4 different calendars in the one

Outlook,
and I want to be able to choose which outlook calendar I add the

appointment
to. Can you tell me how to choose which calendar the appointment will go

to?
thanks for your help! (If this isn't the correct forum for this, please

let
me know which one is) thanks-Paul

The code I'm using currently is below.

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![Date to Arrive] & " " & #9:00:00 AM#
.Duration = 1920
.Subject = Me.Last__First
.body = Me!Notes
End With
Set objAppt = Nothing
End If
Me!AddedToOutlook = True

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

  #3  
Old May 21st 08, 06:29 PM posted to microsoft.public.outlook.program_vba
Paul Access VBA[_2_]
external usenet poster
 
Posts: 2
Default setting appt in multiple Outlook Calendars from Access

Hi Michael
Thanks for your answer. I'm brand new to vba and Outlook though so could you
give me an example of the line of code I would use to do this?
thanks again.
Paul


"Michael Bauer [MVP - Outlook]" wrote:


Use the target folder's Items.Add function.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Mon, 19 May 2008 10:26:02 -0700 schrieb Paul Access VBA:

Hi, I am using vba with Access 2007 to add appointments to an Outlook 2007
Calendar. This is working fine when I add the appointment to the main
Outlook calendar. However, I have 4 different calendars in the one

Outlook,
and I want to be able to choose which outlook calendar I add the

appointment
to. Can you tell me how to choose which calendar the appointment will go

to?
thanks for your help! (If this isn't the correct forum for this, please

let
me know which one is) thanks-Paul

The code I'm using currently is below.

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![Date to Arrive] & " " & #9:00:00 AM#
.Duration = 1920
.Subject = Me.Last__First
.body = Me!Notes
End With
Set objAppt = Nothing
End If
Me!AddedToOutlook = True

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


  #4  
Old May 22nd 08, 08:14 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default setting appt in multiple Outlook Calendars from Access



If it's a subfolder of the default calendar:

Dim Appt as Outlook.AppointmentItem
Dim Folder as Outlook.Mapifolder
Dim Subfolder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFold erCalendar)
Set Subfolder=Folder.Folders("name")
Set Appt=Subfolder.Items.Add

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 21 May 2008 09:29:01 -0700 schrieb Paul Access VBA:

Hi Michael
Thanks for your answer. I'm brand new to vba and Outlook though so could

you
give me an example of the line of code I would use to do this?
thanks again.
Paul


"Michael Bauer [MVP - Outlook]" wrote:


Use the target folder's Items.Add function.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Mon, 19 May 2008 10:26:02 -0700 schrieb Paul Access VBA:

Hi, I am using vba with Access 2007 to add appointments to an Outlook

2007
Calendar. This is working fine when I add the appointment to the main
Outlook calendar. However, I have 4 different calendars in the one

Outlook,
and I want to be able to choose which outlook calendar I add the

appointment
to. Can you tell me how to choose which calendar the appointment will go

to?
thanks for your help! (If this isn't the correct forum for this, please

let
me know which one is) thanks-Paul

The code I'm using currently is below.

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![Date to Arrive] & " " & #9:00:00 AM#
.Duration = 1920
.Subject = Me.Last__First
.body = Me!Notes
End With
Set objAppt = Nothing
End If
Me!AddedToOutlook = True

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


  #5  
Old August 15th 08, 12:18 PM posted to microsoft.public.outlook.program_vba
andy
external usenet poster
 
Posts: 122
Default setting appt in multiple Outlook Calendars from Access

Just reading this post today Michael.

Would this structure work for an open shared calendar? If not, how would you
add an AppointmentItem to a shared calendar (assuming you had permission to
add an item to it). I am using Office 2003 SP2.

Thanks for any help.

"Michael Bauer [MVP - Outlook]" wrote:



If it's a subfolder of the default calendar:

Dim Appt as Outlook.AppointmentItem
Dim Folder as Outlook.Mapifolder
Dim Subfolder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFold erCalendar)
Set Subfolder=Folder.Folders("name")
Set Appt=Subfolder.Items.Add

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 21 May 2008 09:29:01 -0700 schrieb Paul Access VBA:

Hi Michael
Thanks for your answer. I'm brand new to vba and Outlook though so could

you
give me an example of the line of code I would use to do this?
thanks again.
Paul


"Michael Bauer [MVP - Outlook]" wrote:


Use the target folder's Items.Add function.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Mon, 19 May 2008 10:26:02 -0700 schrieb Paul Access VBA:

Hi, I am using vba with Access 2007 to add appointments to an Outlook

2007
Calendar. This is working fine when I add the appointment to the main
Outlook calendar. However, I have 4 different calendars in the one
Outlook,
and I want to be able to choose which outlook calendar I add the
appointment
to. Can you tell me how to choose which calendar the appointment will go
to?
thanks for your help! (If this isn't the correct forum for this, please
let
me know which one is) thanks-Paul

The code I'm using currently is below.

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![Date to Arrive] & " " & #9:00:00 AM#
.Duration = 1920
.Subject = Me.Last__First
.body = Me!Notes
End With
Set objAppt = Nothing
End If
Me!AddedToOutlook = True

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


  #6  
Old August 15th 08, 09:01 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default setting appt in multiple Outlook Calendars from Access



If the shared mailbox is opened, it would work that way. Simply start with
the top Folders collection and walk through the folders by their names. If
it's not opened, use the GetsharedDefaultFolder function.

--
Best regards
Michael Bauer - MVP Outlook

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


Am Fri, 15 Aug 2008 03:18:01 -0700 schrieb Andy:

Just reading this post today Michael.

Would this structure work for an open shared calendar? If not, how would

you
add an AppointmentItem to a shared calendar (assuming you had permission

to
add an item to it). I am using Office 2003 SP2.

Thanks for any help.

"Michael Bauer [MVP - Outlook]" wrote:



If it's a subfolder of the default calendar:

Dim Appt as Outlook.AppointmentItem
Dim Folder as Outlook.Mapifolder
Dim Subfolder as Outlook.Mapifolder

Set Folder=Application.Session.GetDefaultFolder(olFold erCalendar)
Set Subfolder=Folder.Folders("name")
Set Appt=Subfolder.Items.Add

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 21 May 2008 09:29:01 -0700 schrieb Paul Access VBA:

Hi Michael
Thanks for your answer. I'm brand new to vba and Outlook though so could

you
give me an example of the line of code I would use to do this?
thanks again.
Paul


"Michael Bauer [MVP - Outlook]" wrote:


Use the target folder's Items.Add function.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: http://www.vboffice.net/product.html?pub=6&lang=en



Am Mon, 19 May 2008 10:26:02 -0700 schrieb Paul Access VBA:

Hi, I am using vba with Access 2007 to add appointments to an Outlook

2007
Calendar. This is working fine when I add the appointment to the main
Outlook calendar. However, I have 4 different calendars in the one
Outlook,
and I want to be able to choose which outlook calendar I add the
appointment
to. Can you tell me how to choose which calendar the appointment will

go
to?
thanks for your help! (If this isn't the correct forum for this,

please
let
me know which one is) thanks-Paul

The code I'm using currently is below.

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![Date to Arrive] & " " & #9:00:00 AM#
.Duration = 1920
.Subject = Me.Last__First
.body = Me!Notes
End With
Set objAppt = Nothing
End If
Me!AddedToOutlook = True

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


 




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
Private Appt in Web Access? Kim Outlook - Calandaring 0 April 2nd 08 03:36 PM
Outlook reminder times BEFORE appt. vs. AFTER setting appt.? CPAhomie Outlook - Calandaring 4 March 28th 07 02:00 AM
Convert/transform multiple All-day Event on a single day onto multiple To Do element (with None Deadline setting if possible) Federico Oliosi Outlook - Calandaring 0 August 3rd 06 02:42 PM
Find Next Appt / Mtg in multiple calendars. Matt Carter Outlook - Calandaring 0 July 18th 06 02:38 PM
Outlook/Access 2003 - Outlook View Control on Form w/ Multiple Calendars scs Outlook - General Queries 5 April 6th 06 03:18 PM


All times are GMT +1. The time now is 04: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.