Stephen
stephen at bondsoftware.co.nz
Wed Jun 17 12:55:59 CDT 2009
Rocky Can't sleep, being doing some 'learning' via your Outlook problem. Cobbled up this and it works here, on a non-default folder. <code> Sub ShortTestNonDefault() Dim i As Long Dim ol As Outlook.Application Dim olns As NameSpace Dim myFolder1 As Object, myFolder2 As Object Dim myFolder3 As Object Dim itemCount As Long, SpecificItem As Object Dim myAppointments As Items Dim myItems As Outlook.Items, rItems As Outlook.Items ' Automation code example. Set ol = GetObject(, "Outlook.Application") Set olns = ol.GetNamespace("MAPI") Set myFolder1 = olns.Folders("Public Folders") Set myFolder2 = myFolder1.Folders("All Public Folders") Set myFolder3 = myFolder2.Folders("Arrowtown Bookings") itemCount = myFolder3.Items.Count ' Set myItems to the collection of items in the folder. Set myItems = myFolder3.Items ' display from the start of this month only Set rItems = myItems.Restrict("[Start] > '01/6/2009'") ' Loop through all of the items in the folder. For Each SpecificItem In rItems Debug.Print SpecificItem.Subject, SpecificItem.Start, SpecificItem.End Next ' try adding one Set SpecificItem = myFolder3.Items.Add With SpecificItem .Start = #6/18/2009 3:00:00 PM# .End = DateAdd("h", 1, .Start) .Subject = "Just a test" .Save End With Set SpecificItem = Nothing: Set myItems = Nothing: Set rItems = Nothing Set myAppointments = Nothing Set myFolder3 = Nothing Set myFolder2 = Nothing: Set myFolder1 = Nothing Set olns = Nothing Set ol = Nothing End Sub </code> HTH Stephen Bond -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: Thursday, 18 June 2009 4:00 a.m. To: Stephen Subject: Re: [AccessD] FW: AMS Update Yeah - I took a look at it. It may give me a lead on a solution. The problem is that I'm not there so it's hard to do the trial and error thing. I'll parse it out later and see if I can get a clue how to do it. Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins Sent: Wednesday, June 17, 2009 8:24 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] FW: AMS Update Rocky, did you get that link I sent yesterday? At the bottom of the code, it looked like they were referencing a custom calendar. When I'm stuck like this, I put together a For loop that prints the properties, objects, whatever of the appropriate collection/object. Susan H. > > As you can see from the email below, the function to add a date to the > Outlook calendar works except, as I thought, it goes to his personal > calendar and not the shared one. Does anybody know offhand how one > points to a different calendar when automating Outlook from Access? > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com