 |
|
|
|
| Author |
Message |
bluesbrthr
Joined: 13 Aug 2007 Posts: 10
|
Posted: Mon Feb 04, 2008 7:51 pm Post subject: IncludeRecurrences 2003 vs 2007 |
|
|
I've written a macro that will export all of my appointments to
Excel. With Office 2007, this works fine, but on other computers
running Office 2003, it does not work. The issue that 2003 does not
show the recurring items while 2007 does.
The start of my code is this:
Dim SafeAppointment, oAppointment
Dim olOutlook As Outlook.Application
Dim nsNameSpace As NameSpace
Dim mItemCollection As Items
Dim dStart As Date
Dim dDatePlace As Date
Dim dLastCalendarDate As Date
Dim bPrintBlanks As Boolean
Dim filter1 As String
filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
yy") & "'"
Set olOutlook = CreateObject("Outlook.Application")
Set nsNameSpace = olOutlook.GetNamespace("MAPI")
Set mItemCollection =
nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
mItemCollection.Sort "[Start]", False
mItemCollection.IncludeRecurrences = True
Set mitem = mItemCollection.Find("[Start] >= '" &
Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
' LOOP OF CALENDAR ITEMS
***********************************************************************************************************************************************************
While TypeName(mitem) = "AppointmentItem"
Archived from group: microsoft>public>office>developer>outlook>vba |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Tue Feb 05, 2008 2:47 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
Is Redemption installed on the Outlook 2003 computer? What errors if any are
you getting? Where does the code fail if you step it in Excel?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
wrote in message @l1g2000hsa.googlegroups.com...
> I've written a macro that will export all of my appointments to
> Excel. With Office 2007, this works fine, but on other computers
> running Office 2003, it does not work. The issue that 2003 does not
> show the recurring items while 2007 does.
>
> The start of my code is this:
>
>
> Dim SafeAppointment, oAppointment
> Dim olOutlook As Outlook.Application
> Dim nsNameSpace As NameSpace
> Dim mItemCollection As Items
>
> Dim dStart As Date
>
> Dim dDatePlace As Date
> Dim dLastCalendarDate As Date
> Dim bPrintBlanks As Boolean
>
> Dim filter1 As String
> filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
> yy") & "'"
>
> Set olOutlook = CreateObject("Outlook.Application")
> Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> Set mItemCollection =
> nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>
> mItemCollection.Sort "[Start]", False
> mItemCollection.IncludeRecurrences = True
> Set mitem = mItemCollection.Find("[Start] >= '" &
> Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>
>
> ' LOOP OF CALENDAR ITEMS
> ***********************************************************************************************************************************************************
> While TypeName(mitem) = "AppointmentItem" |
|
| Back to top |
|
 |
bluesbrthr
Joined: 13 Aug 2007 Posts: 10
|
Posted: Tue Feb 05, 2008 11:57 am Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
Yes, Redemption is installed.
I don't get any errors at all, but the recurring items are not
exported. They only time they are exported is if the very first date
is in the selected date range. It's like the "IncludeRecurrences" is
being ignored.
On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
wrote:
> Is Redemption installed on the Outlook 2003 computer? What errors if any are
> you getting? Where does the code fail if you step it in Excel?
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> wrote in message
>
> @l1g2000hsa.googlegroups.com...
>
> > I've written a macro that will export all of my appointments to
> > Excel. With Office 2007, this works fine, but on other computers
> > running Office 2003, it does not work. The issue that 2003 does not
> > show the recurring items while 2007 does.
>
> > The start of my code is this:
>
> > Dim SafeAppointment, oAppointment
> > Dim olOutlook As Outlook.Application
> > Dim nsNameSpace As NameSpace
> > Dim mItemCollection As Items
>
> > Dim dStart As Date
>
> > Dim dDatePlace As Date
> > Dim dLastCalendarDate As Date
> > Dim bPrintBlanks As Boolean
>
> > Dim filter1 As String
> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
> > yy") & "'"
>
> > Set olOutlook = CreateObject("Outlook.Application")
> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> > Set mItemCollection =
> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>
> > mItemCollection.Sort "[Start]", False
> > mItemCollection.IncludeRecurrences = True
> > Set mitem = mItemCollection.Find("[Start] >= '" &
> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>
> > ' LOOP OF CALENDAR ITEMS
> > ***********************************************************************************************************************************************************
> > While TypeName(mitem) = "AppointmentItem" |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Tue Feb 05, 2008 5:01 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
I repro'd that here too. I never noticed that before. I'd have to research
if that's a known limitation or something that's undocumented.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
wrote in message @d21g2000prf.googlegroups.com...
> Yes, Redemption is installed.
>
> I don't get any errors at all, but the recurring items are not
> exported. They only time they are exported is if the very first date
> is in the selected date range. It's like the "IncludeRecurrences" is
> being ignored. |
|
| Back to top |
|
 |
Sue Mosher [MVP-Outlook]
Joined: 12 Aug 2007 Posts: 656
|
Posted: Tue Feb 05, 2008 5:07 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
Try changing your filter so that it uses both dates and not just the Start date:
filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
"' AND [Start] < '" & _
Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
wrote in message @d21g2000prf.googlegroups.com...
> Yes, Redemption is installed.
>
> I don't get any errors at all, but the recurring items are not
> exported. They only time they are exported is if the very first date
> is in the selected date range. It's like the "IncludeRecurrences" is
> being ignored.
>
>
> On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
> wrote:
>> Is Redemption installed on the Outlook 2003 computer? What errors if any are
>> you getting? Where does the code fail if you step it in Excel?
>>
>> --
>> Ken Slovak
>> [MVP - Outlook]http://www.slovaktech.com
>> Author: Professional Programming Outlook 2007
>> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>>
>> wrote in message
>>
>> @l1g2000hsa.googlegroups.com...
>>
>> > I've written a macro that will export all of my appointments to
>> > Excel. With Office 2007, this works fine, but on other computers
>> > running Office 2003, it does not work. The issue that 2003 does not
>> > show the recurring items while 2007 does.
>>
>> > The start of my code is this:
>>
>> > Dim SafeAppointment, oAppointment
>> > Dim olOutlook As Outlook.Application
>> > Dim nsNameSpace As NameSpace
>> > Dim mItemCollection As Items
>>
>> > Dim dStart As Date
>>
>> > Dim dDatePlace As Date
>> > Dim dLastCalendarDate As Date
>> > Dim bPrintBlanks As Boolean
>>
>> > Dim filter1 As String
>> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
>> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
>> > yy") & "'"
>>
>> > Set olOutlook = CreateObject("Outlook.Application")
>> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
>> > Set mItemCollection =
>> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>>
>> > mItemCollection.Sort "[Start]", False
>> > mItemCollection.IncludeRecurrences = True
>> > Set mitem = mItemCollection.Find("[Start] >= '" &
>> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
>> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>>
>> > ' LOOP OF CALENDAR ITEMS
>> > ***********************************************************************************************************************************************************
>> > While TypeName(mitem) = "AppointmentItem"
> |
|
| Back to top |
|
 |
bluesbrthr
Joined: 13 Aug 2007 Posts: 10
|
Posted: Tue Feb 05, 2008 3:10 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
On Feb 5, 12:07 pm, "Sue Mosher [MVP-Outlook]"
wrote:
> Try changing your filter so that it uses both dates and not just the Start date:
>
> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
> "' AND [Start] < '" & _
> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
> wrote in message@d21g2000prf.googlegroups.com...
> > Yes, Redemption is installed.
>
> > I don't get any errors at all, but the recurring items are not
> > exported. They only time they are exported is if the very first date
> > is in the selected date range. It's like the "IncludeRecurrences" is
> > being ignored.
>
> > On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
> > wrote:
> >> Is Redemption installed on the Outlook 2003 computer? What errors if any are
> >> you getting? Where does the code fail if you step it in Excel?
>
> >> --
> >> Ken Slovak
> >> [MVP - Outlook]http://www.slovaktech.com
> >> Author: Professional Programming Outlook 2007
> >> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> >> wrote in message
>
> >>@l1g2000hsa.googlegroups.com...
>
> >> > I've written a macro that will export all of my appointments to
> >> > Excel. With Office 2007, this works fine, but on other computers
> >> > running Office 2003, it does not work. The issue that 2003 does not
> >> > show the recurring items while 2007 does.
>
> >> > The start of my code is this:
>
> >> > Dim SafeAppointment, oAppointment
> >> > Dim olOutlook As Outlook.Application
> >> > Dim nsNameSpace As NameSpace
> >> > Dim mItemCollection As Items
>
> >> > Dim dStart As Date
>
> >> > Dim dDatePlace As Date
> >> > Dim dLastCalendarDate As Date
> >> > Dim bPrintBlanks As Boolean
>
> >> > Dim filter1 As String
> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> >> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
> >> > yy") & "'"
>
> >> > Set olOutlook = CreateObject("Outlook.Application")
> >> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> >> > Set mItemCollection =
> >> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>
> >> > mItemCollection.Sort "[Start]", False
> >> > mItemCollection.IncludeRecurrences = True
> >> > Set mitem = mItemCollection.Find("[Start] >= '" &
> >> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>
> >> > ' LOOP OF CALENDAR ITEMS
> >> > ***********************************************************************************************************************************************************
> >> > While TypeName(mitem) = "AppointmentItem"
Sue, it looks like you mixed up the Start and End in the filter. I
think that would have brought back everything but what we were trying
to pull. Anyway, I swapped it and I'm still having the same issue.
I changed the filter to be:
filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
yy") & _
"' AND [End] < '" & _
Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
This had the same results as before. Then I remembered the Find
statement still uses the Start date twice instead of the Start and
End. I switched this up and had the same results. |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Tue Feb 05, 2008 6:56 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
No, Sue is correct in that format, End before Start.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
wrote in message @k2g2000hse.googlegroups.com...
> Sue, it looks like you mixed up the Start and End in the filter. I
> think that would have brought back everything but what we were trying
> to pull. Anyway, I swapped it and I'm still having the same issue.
>
> I changed the filter to be:
>
> filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> yy") & _
> "' AND [End] < '" & _
> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
>
> This had the same results as before. Then I remembered the Find
> statement still uses the Start date twice instead of the Start and
> End. I switched this up and had the same results. |
|
| Back to top |
|
 |
bluesbrthr
Joined: 13 Aug 2007 Posts: 10
|
Posted: Tue Feb 05, 2008 4:18 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
On Feb 5, 1:56 pm, "Ken Slovak - [MVP - Outlook]"
wrote:
> No, Sue is correct in that format, End before Start.
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> wrote in message
>
> @k2g2000hse.googlegroups.com...
>
>
> > Sue, it looks like you mixed up the Start and End in the filter. I
> > think that would have brought back everything but what we were trying
> > to pull. Anyway, I swapped it and I'm still having the same issue.
>
> > I changed the filter to be:
>
> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> > yy") & _
> > "' AND [End] < '" & _
> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> > This had the same results as before. Then I remembered the Find
> > statement still uses the Start date twice instead of the Start and
> > End. I switched this up and had the same results.
Damn... note to self, always listen to the MVP's Actually, when it
didn't make any difference, I should have changed it to the original
code.
I just tested it with Sue's original code and it still doesn't work.
Same results. |
|
| Back to top |
|
 |
Sue Mosher [MVP-Outlook]
Joined: 12 Aug 2007 Posts: 656
|
Posted: Tue Feb 05, 2008 6:22 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
It's not mixed up at all. Think about it: An appointment can lie wholly within the range you want to check, partially overlap it, or completely overlap it. Therefore, if you want all the appointments within a particular range, you need to look for appointments that end after the start of the range and begin before the end of the range. The blog article at http://weblogs.asp.net/whaggard/archive/2007/03/21/retrieving-your-outlook-appointments-for-a-given-date-range.aspx has a good graphic representation for this.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
wrote in message @k2g2000hse.googlegroups.com...
> On Feb 5, 12:07 pm, "Sue Mosher [MVP-Outlook]"
> wrote:
>> Try changing your filter so that it uses both dates and not just the Start date:
>>
>> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
>> "' AND [Start] < '" & _
>> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>>
>> wrote in message@d21g2000prf.googlegroups..com...
>> > Yes, Redemption is installed.
>>
>> > I don't get any errors at all, but the recurring items are not
>> > exported. They only time they are exported is if the very first date
>> > is in the selected date range. It's like the "IncludeRecurrences" is
>> > being ignored.
>>
>> > On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
>> > wrote:
>> >> Is Redemption installed on the Outlook 2003 computer? What errors if any are
>> >> you getting? Where does the code fail if you step it in Excel?
>>
>> >> --
>> >> Ken Slovak
>> >> [MVP - Outlook]http://www.slovaktech.com
>> >> Author: Professional Programming Outlook 2007
>> >> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>>
>> >> wrote in message
>>
>> >>@l1g2000hsa.googlegroups.com....
>>
>> >> > I've written a macro that will export all of my appointments to
>> >> > Excel. With Office 2007, this works fine, but on other computers
>> >> > running Office 2003, it does not work. The issue that 2003 does not
>> >> > show the recurring items while 2007 does.
>>
>> >> > The start of my code is this:
>>
>> >> > Dim SafeAppointment, oAppointment
>> >> > Dim olOutlook As Outlook.Application
>> >> > Dim nsNameSpace As NameSpace
>> >> > Dim mItemCollection As Items
>>
>> >> > Dim dStart As Date
>>
>> >> > Dim dDatePlace As Date
>> >> > Dim dLastCalendarDate As Date
>> >> > Dim bPrintBlanks As Boolean
>>
>> >> > Dim filter1 As String
>> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
>> >> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
>> >> > yy") & "'"
>>
>> >> > Set olOutlook = CreateObject("Outlook.Application")
>> >> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
>> >> > Set mItemCollection =
>> >> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>>
>> >> > mItemCollection.Sort "[Start]", False
>> >> > mItemCollection.IncludeRecurrences = True
>> >> > Set mitem = mItemCollection.Find("[Start] >= '" &
>> >> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
>> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>>
>> >> > ' LOOP OF CALENDAR ITEMS
>> >> > ***********************************************************************************************************************************************************
>> >> > While TypeName(mitem) = "AppointmentItem"
>
>
> Sue, it looks like you mixed up the Start and End in the filter. I
> think that would have brought back everything but what we were trying
> to pull. Anyway, I swapped it and I'm still having the same issue.
>
> I changed the filter to be:
>
> filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> yy") & _
> "' AND [End] < '" & _
> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
>
> This had the same results as before. Then I remembered the Find
> statement still uses the Start date twice instead of the Start and
> End. I switched this up and had the same results. |
|
| Back to top |
|
 |
bluesbrthr
Joined: 13 Aug 2007 Posts: 10
|
Posted: Tue Feb 05, 2008 5:46 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
On Feb 5, 1:22 pm, "Sue Mosher [MVP-Outlook]"
wrote:
> It's not mixed up at all. Think about it: An appointment can lie wholly within the range you want to check, partially overlap it, or completely overlap it. Therefore, if you want all the appointments within a particular range, you need to look for appointments that end after the start of the range and begin before the end of the range. The blog article athttp://weblogs.asp.net/whaggard/archive/2007/03/21/retrieving-your-ou...has a good graphic representation for this.
>
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
> wrote in message@k2g2000hse.googlegroups.com...
> > On Feb 5, 12:07 pm, "Sue Mosher [MVP-Outlook]"
> > wrote:
> >> Try changing your filter so that it uses both dates and not just the Start date:
>
> >> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
> >> "' AND [Start] < '" & _
> >> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> >> wrote in message@d21g2000prf.googlegroups.com...
> >> > Yes, Redemption is installed.
>
> >> > I don't get any errors at all, but the recurring items are not
> >> > exported. They only time they are exported is if the very first date
> >> > is in the selected date range. It's like the "IncludeRecurrences" is
> >> > being ignored.
>
> >> > On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
> >> > wrote:
> >> >> Is Redemption installed on the Outlook 2003 computer? What errors if any are
> >> >> you getting? Where does the code fail if you step it in Excel?
>
> >> >> --
> >> >> Ken Slovak
> >> >> [MVP - Outlook]http://www.slovaktech.com
> >> >> Author: Professional Programming Outlook 2007
> >> >> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> >> >> wrote in message
>
> >> >>@l1g2000hsa.googlegroups.com...
>
> >> >> > I've written a macro that will export all of my appointments to
> >> >> > Excel. With Office 2007, this works fine, but on other computers
> >> >> > running Office 2003, it does not work. The issue that 2003 does not
> >> >> > show the recurring items while 2007 does.
>
> >> >> > The start of my code is this:
>
> >> >> > Dim SafeAppointment, oAppointment
> >> >> > Dim olOutlook As Outlook.Application
> >> >> > Dim nsNameSpace As NameSpace
> >> >> > Dim mItemCollection As Items
>
> >> >> > Dim dStart As Date
>
> >> >> > Dim dDatePlace As Date
> >> >> > Dim dLastCalendarDate As Date
> >> >> > Dim bPrintBlanks As Boolean
>
> >> >> > Dim filter1 As String
> >> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> >> >> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
> >> >> > yy") & "'"
>
> >> >> > Set olOutlook = CreateObject("Outlook.Application")
> >> >> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> >> >> > Set mItemCollection =
> >> >> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>
> >> >> > mItemCollection.Sort "[Start]", False
> >> >> > mItemCollection.IncludeRecurrences = True
> >> >> > Set mitem = mItemCollection.Find("[Start] >= '" &
> >> >> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
> >> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>
> >> >> > ' LOOP OF CALENDAR ITEMS
> >> >> > ***********************************************************************************************************************************************************
> >> >> > While TypeName(mitem) = "AppointmentItem"
>
> > Sue, it looks like you mixed up the Start and End in the filter. I
> > think that would have brought back everything but what we were trying
> > to pull. Anyway, I swapped it and I'm still having the same issue.
>
> > I changed the filter to be:
>
> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> > yy") & _
> > "' AND [End] < '" & _
> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> > This had the same results as before. Then I remembered the Find
> > statement still uses the Start date twice instead of the Start and
> > End. I switched this up and had the same results.
Yeah, I got confused when I saw it, but it makes sense now.
Regardless, that didn't solve the issue. |
|
| Back to top |
|
 |
Sue Mosher [MVP-Outlook]
Joined: 12 Aug 2007 Posts: 656
|
Posted: Tue Feb 05, 2008 8:57 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
I think the problem is that you're doing filtering twice and using IncludeRecurrences only on the second filter. You only need to filter once:
Dim filter1 As String
filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
"' AND [Start] < '" & _
Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
Set olOutlook = CreateObject("Outlook.Application")
Set nsNameSpace = olOutlook.GetNamespace("MAPI")
Set myItems = GetDefaultFolder(olFolderCalendar).Items
myItems.Sort "[Start]", False
myItems.IncludeRecurrences = True
Set mItemCollection = myItems.Restrict(filter1)
'loop
For Each item in myItemCollection
If item.Class = olAppointment Then
' process item
End If
Next
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
wrote in message @k39g2000hsf.googlegroups.com...
> On Feb 5, 1:22 pm, "Sue Mosher [MVP-Outlook]"
> wrote:
>> It's not mixed up at all. Think about it: An appointment can lie wholly within the range you want to check, partially overlap it, or completely overlap it. Therefore, if you want all the appointments within a particular range, you need to look for appointments that end after the start of the range and begin before the end of the range. The blog article athttp://weblogs.asp.net/whaggard/archive/2007/03/21/retrieving-your-ou....has a good graphic representation for this.
>>
>> wrote in message@k2g2000hse.googlegroups.com...
>> > On Feb 5, 12:07 pm, "Sue Mosher [MVP-Outlook]"
>> > wrote:
>> >> Try changing your filter so that it uses both dates and not just the Start date:
>>
>> >> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
>> >> "' AND [Start] < '" & _
>> >> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>>
>> >> wrote in message@d21g2000prf.googlegroups..com...
>> >> > Yes, Redemption is installed.
>>
>> >> > I don't get any errors at all, but the recurring items are not
>> >> > exported. They only time they are exported is if the very first date
>> >> > is in the selected date range. It's like the "IncludeRecurrences" is
>> >> > being ignored.
>>
>> >> > On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
>> >> > wrote:
>> >> >> Is Redemption installed on the Outlook 2003 computer? What errors if any are
>> >> >> you getting? Where does the code fail if you step it in Excel?
>>
>> >> >> --
>> >> >> Ken Slovak
>> >> >> [MVP - Outlook]http://www.slovaktech.com
>> >> >> Author: Professional Programming Outlook 2007
>> >> >> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>>
>> >> >> wrote in message
>>
>> >> >>@l1g2000hsa.googlegroups.com....
>>
>> >> >> > I've written a macro that will export all of my appointments to
>> >> >> > Excel. With Office 2007, this works fine, but on other computers
>> >> >> > running Office 2003, it does not work. The issue that 2003 does not
>> >> >> > show the recurring items while 2007 does.
>>
>> >> >> > The start of my code is this:
>>
>> >> >> > Dim SafeAppointment, oAppointment
>> >> >> > Dim olOutlook As Outlook.Application
>> >> >> > Dim nsNameSpace As NameSpace
>> >> >> > Dim mItemCollection As Items
>>
>> >> >> > Dim dStart As Date
>>
>> >> >> > Dim dDatePlace As Date
>> >> >> > Dim dLastCalendarDate As Date
>> >> >> > Dim bPrintBlanks As Boolean
>>
>> >> >> > Dim filter1 As String
>> >> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
>> >> >> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
>> >> >> > yy") & "'"
>>
>> >> >> > Set olOutlook = CreateObject("Outlook.Application")
>> >> >> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
>> >> >> > Set mItemCollection =
>> >> >> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>>
>> >> >> > mItemCollection.Sort "[Start]", False
>> >> >> > mItemCollection.IncludeRecurrences = True
>> >> >> > Set mitem = mItemCollection.Find("[Start] >= '" &
>> >> >> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
>> >> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>>
>> >> >> > ' LOOP OF CALENDAR ITEMS
>> >> >> > ***********************************************************************************************************************************************************
>> >> >> > While TypeName(mitem) = "AppointmentItem"
>>
>> > Sue, it looks like you mixed up the Start and End in the filter. I
>> > think that would have brought back everything but what we were trying
>> > to pull. Anyway, I swapped it and I'm still having the same issue.
>>
>> > I changed the filter to be:
>>
>> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
>> > yy") & _
>> > "' AND [End] < '" & _
>> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>>
>> > This had the same results as before. Then I remembered the Find
>> > statement still uses the Start date twice instead of the Start and
>> > End. I switched this up and had the same results.
>
> Yeah, I got confused when I saw it, but it makes sense now.
> Regardless, that didn't solve the issue.
> |
|
| Back to top |
|
 |
bluesbrthr
Joined: 13 Aug 2007 Posts: 10
|
Posted: Tue Feb 05, 2008 6:23 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
On Feb 5, 3:57 pm, "Sue Mosher [MVP-Outlook]"
wrote:
> I think the problem is that you're doing filtering twice and using IncludeRecurrences only on the second filter. You only need to filter once:
>
> Dim filter1 As String
> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
> "' AND [Start] < '" & _
> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
> Set olOutlook = CreateObject("Outlook.Application")
> Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> Set myItems = GetDefaultFolder(olFolderCalendar).Items
> myItems.Sort "[Start]", False
> myItems.IncludeRecurrences = True
> Set mItemCollection = myItems.Restrict(filter1)
> 'loop
> For Each item in myItemCollection
> If item.Class = olAppointment Then
> ' process item
> End If
> Next
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
> wrote in message@k39g2000hsf.googlegroups.com...
> > On Feb 5, 1:22 pm, "Sue Mosher [MVP-Outlook]"
> > wrote:
> >> It's not mixed up at all. Think about it: An appointment can lie wholly within the range you want to check, partially overlap it, or completely overlap it. Therefore, if you want all the appointments within a particular range, you need to look for appointments that end after the start of the range and begin before the end of the range. The blog article athttp://weblogs.asp.net/whaggard/archive/2007/03/21/retrieving-your-ou...a good graphic representation for this.
>
> >> wrote in message@k2g2000hse.googlegroups.com...
> >> > On Feb 5, 12:07 pm, "Sue Mosher [MVP-Outlook]"
> >> > wrote:
> >> >> Try changing your filter so that it uses both dates and not just the Start date:
>
> >> >> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
> >> >> "' AND [Start] < '" & _
> >> >> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> >> >> wrote in message@d21g2000prf.googlegroups.com...
> >> >> > Yes, Redemption is installed.
>
> >> >> > I don't get any errors at all, but the recurring items are not
> >> >> > exported. They only time they are exported is if the very first date
> >> >> > is in the selected date range. It's like the "IncludeRecurrences" is
> >> >> > being ignored.
>
> >> >> > On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
> >> >> > wrote:
> >> >> >> Is Redemption installed on the Outlook 2003 computer? What errors if any are
> >> >> >> you getting? Where does the code fail if you step it in Excel?
>
> >> >> >> --
> >> >> >> Ken Slovak
> >> >> >> [MVP - Outlook]http://www.slovaktech.com
> >> >> >> Author: Professional Programming Outlook 2007
> >> >> >> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> >> >> >> wrote in message
>
> >> >> >>@l1g2000hsa.googlegroups.com...
>
> >> >> >> > I've written a macro that will export all of my appointments to
> >> >> >> > Excel. With Office 2007, this works fine, but on other computers
> >> >> >> > running Office 2003, it does not work. The issue that 2003 does not
> >> >> >> > show the recurring items while 2007 does.
>
> >> >> >> > The start of my code is this:
>
> >> >> >> > Dim SafeAppointment, oAppointment
> >> >> >> > Dim olOutlook As Outlook.Application
> >> >> >> > Dim nsNameSpace As NameSpace
> >> >> >> > Dim mItemCollection As Items
>
> >> >> >> > Dim dStart As Date
>
> >> >> >> > Dim dDatePlace As Date
> >> >> >> > Dim dLastCalendarDate As Date
> >> >> >> > Dim bPrintBlanks As Boolean
>
> >> >> >> > Dim filter1 As String
> >> >> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> >> >> >> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
> >> >> >> > yy") & "'"
>
> >> >> >> > Set olOutlook = CreateObject("Outlook.Application")
> >> >> >> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> >> >> >> > Set mItemCollection =
> >> >> >> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>
> >> >> >> > mItemCollection.Sort "[Start]", False
> >> >> >> > mItemCollection.IncludeRecurrences = True
> >> >> >> > Set mitem = mItemCollection.Find("[Start] >= '" &
> >> >> >> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
> >> >> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>
> >> >> >> > ' LOOP OF CALENDAR ITEMS
> >> >> >> > ***********************************************************************************************************************************************************
> >> >> >> > While TypeName(mitem) = "AppointmentItem"
>
> >> > Sue, it looks like you mixed up the Start and End in the filter. I
> >> > think that would have brought back everything but what we were trying
> >> > to pull. Anyway, I swapped it and I'm still having the same issue.
>
> >> > I changed the filter to be:
>
> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> >> > yy") & _
> >> > "' AND [End] < '" & _
> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> >> > This had the same results as before. Then I remembered the Find
> >> > statement still uses the Start date twice instead of the Start and
> >> > End. I switched this up and had the same results.
>
> > Yeah, I got confused when I saw it, but it makes sense now.
> > Regardless, that didn't solve the issue.
Thanks. I changed the code and on the line"For Each Item In
myItemCollection" it returns the error "Run-time Error 13 Type
mismatch" |
|
| Back to top |
|
 |
bluesbrthr
Joined: 13 Aug 2007 Posts: 10
|
Posted: Tue Feb 05, 2008 6:32 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
On Feb 5, 4:23 pm, bluesbr...@gmail.com wrote:
> On Feb 5, 3:57 pm, "Sue Mosher [MVP-Outlook]"
> wrote:
>
>
>
> > I think the problem is that you're doing filtering twice and using IncludeRecurrences only on the second filter. You only need to filter once:
>
> > Dim filter1 As String
> > filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
> > "' AND [Start] < '" & _
> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
> > Set olOutlook = CreateObject("Outlook.Application")
> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> > Set myItems = GetDefaultFolder(olFolderCalendar).Items
> > myItems.Sort "[Start]", False
> > myItems.IncludeRecurrences = True
> > Set mItemCollection = myItems.Restrict(filter1)
> > 'loop
> > For Each item in myItemCollection
> > If item.Class = olAppointment Then
> > ' process item
> > End If
> > Next
> > --
> > Sue Mosher, Outlook MVP
> > Author of Microsoft Outlook 2007 Programming:
> > Jumpstart for Power Users and Administrators
> > http://www.outlookcode.com/article.aspx?id=54
>
> > wrote in message@k39g2000hsf.googlegroups.com...
> > > On Feb 5, 1:22 pm, "Sue Mosher [MVP-Outlook]"
> > > wrote:
> > >> It's not mixed up at all. Think about it: An appointment can lie wholly within the range you want to check, partially overlap it, or completely overlap it. Therefore, if you want all the appointments within a particular range, you need to look for appointments that end after the start of the range and begin before the end of the range. The blog article athttp://weblogs.asp.net/whaggard/archive/2007/03/21/retrieving-your-ou...good graphic representation for this.
>
> > >> wrote in message@k2g2000hse.googlegroups.com...
> > >> > On Feb 5, 12:07 pm, "Sue Mosher [MVP-Outlook]"
> > >> > wrote:
> > >> >> Try changing your filter so that it uses both dates and not just the Start date:
>
> > >> >> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
> > >> >> "' AND [Start] < '" & _
> > >> >> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> > >> >> wrote in message@d21g2000prf.googlegroups.com...
> > >> >> > Yes, Redemption is installed.
>
> > >> >> > I don't get any errors at all, but the recurring items are not
> > >> >> > exported. They only time they are exported is if the very first date
> > >> >> > is in the selected date range. It's like the "IncludeRecurrences" is
> > >> >> > being ignored.
>
> > >> >> > On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
> > >> >> > wrote:
> > >> >> >> Is Redemption installed on the Outlook 2003 computer? What errors if any are
> > >> >> >> you getting? Where does the code fail if you step it in Excel?
>
> > >> >> >> --
> > >> >> >> Ken Slovak
> > >> >> >> [MVP - Outlook]http://www.slovaktech.com
> > >> >> >> Author: Professional Programming Outlook 2007
> > >> >> >> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> > >> >> >> wrote in message
>
> > >> >> >>@l1g2000hsa.googlegroups.com...
>
> > >> >> >> > I've written a macro that will export all of my appointments to
> > >> >> >> > Excel. With Office 2007, this works fine, but on other computers
> > >> >> >> > running Office 2003, it does not work. The issue that 2003 does not
> > >> >> >> > show the recurring items while 2007 does.
>
> > >> >> >> > The start of my code is this:
>
> > >> >> >> > Dim SafeAppointment, oAppointment
> > >> >> >> > Dim olOutlook As Outlook.Application
> > >> >> >> > Dim nsNameSpace As NameSpace
> > >> >> >> > Dim mItemCollection As Items
>
> > >> >> >> > Dim dStart As Date
>
> > >> >> >> > Dim dDatePlace As Date
> > >> >> >> > Dim dLastCalendarDate As Date
> > >> >> >> > Dim bPrintBlanks As Boolean
>
> > >> >> >> > Dim filter1 As String
> > >> >> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> > >> >> >> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
> > >> >> >> > yy") & "'"
>
> > >> >> >> > Set olOutlook = CreateObject("Outlook.Application")
> > >> >> >> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> > >> >> >> > Set mItemCollection =
> > >> >> >> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>
> > >> >> >> > mItemCollection.Sort "[Start]", False
> > >> >> >> > mItemCollection.IncludeRecurrences = True
> > >> >> >> > Set mitem = mItemCollection.Find("[Start] >= '" &
> > >> >> >> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
> > >> >> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>
> > >> >> >> > ' LOOP OF CALENDAR ITEMS
> > >> >> >> > ***********************************************************************************************************************************************************
> > >> >> >> > While TypeName(mitem) = "AppointmentItem"
>
> > >> > Sue, it looks like you mixed up the Start and End in the filter. I
> > >> > think that would have brought back everything but what we were trying
> > >> > to pull. Anyway, I swapped it and I'm still having the same issue.
>
> > >> > I changed the filter to be:
>
> > >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> > >> > yy") & _
> > >> > "' AND [End] < '" & _
> > >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> > >> > This had the same results as before. Then I remembered the Find
> > >> > statement still uses the Start date twice instead of the Start and
> > >> > End. I switched this up and had the same results.
>
> > > Yeah, I got confused when I saw it, but it makes sense now.
> > > Regardless, that didn't solve the issue.
>
> Thanks. I changed the code and on the line"For Each Item In
> myItemCollection" it returns the error "Run-time Error 13 Type
> mismatch"
ok, found that error. The code used mItemCollection and
myItemCollection ... |
|
| Back to top |
|
 |
bluesbrthr
Joined: 13 Aug 2007 Posts: 10
|
Posted: Tue Feb 05, 2008 6:50 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
On Feb 5, 4:32 pm, bluesbr...@gmail.com wrote:
> On Feb 5, 4:23 pm, bluesbr...@gmail.com wrote:
>
>
>
> > On Feb 5, 3:57 pm, "Sue Mosher [MVP-Outlook]"
> > wrote:
>
> > > I think the problem is that you're doing filtering twice and using IncludeRecurrences only on the second filter. You only need to filter once:
>
> > > Dim filter1 As String
> > > filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
> > > "' AND [Start] < '" & _
> > > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
> > > Set olOutlook = CreateObject("Outlook.Application")
> > > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> > > Set myItems = GetDefaultFolder(olFolderCalendar).Items
> > > myItems.Sort "[Start]", False
> > > myItems.IncludeRecurrences = True
> > > Set mItemCollection = myItems.Restrict(filter1)
> > > 'loop
> > > For Each item in myItemCollection
> > > If item.Class = olAppointment Then
> > > ' process item
> > > End If
> > > Next
> > > --
> > > Sue Mosher, Outlook MVP
> > > Author of Microsoft Outlook 2007 Programming:
> > > Jumpstart for Power Users and Administrators
> > > http://www.outlookcode.com/article.aspx?id=54
>
> > > wrote in message@k39g2000hsf.googlegroups.com...
> > > > On Feb 5, 1:22 pm, "Sue Mosher [MVP-Outlook]"
> > > > wrote:
> > > >> It's not mixed up at all. Think about it: An appointment can lie wholly within the range you want to check, partially overlap it, or completely overlap it. Therefore, if you want all the appointments within a particular range, you need to look for appointments that end after the start of the range and begin before the end of the range. The blog article athttp://weblogs.asp.net/whaggard/archive/2007/03/21/retrieving-your-ou...graphic representation for this.
>
> > > >> wrote in message@k2g2000hse.googlegroups.com...
> > > >> > On Feb 5, 12:07 pm, "Sue Mosher [MVP-Outlook]"
> > > >> > wrote:
> > > >> >> Try changing your filter so that it uses both dates and not just the Start date:
>
> > > >> >> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
> > > >> >> "' AND [Start] < '" & _
> > > >> >> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> > > >> >> wrote in message@d21g2000prf.googlegroups.com...
> > > >> >> > Yes, Redemption is installed.
>
> > > >> >> > I don't get any errors at all, but the recurring items are not
> > > >> >> > exported. They only time they are exported is if the very first date
> > > >> >> > is in the selected date range. It's like the "IncludeRecurrences" is
> > > >> >> > being ignored.
>
> > > >> >> > On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
> > > >> >> > wrote:
> > > >> >> >> Is Redemption installed on the Outlook 2003 computer? What errors if any are
> > > >> >> >> you getting? Where does the code fail if you step it in Excel?
>
> > > >> >> >> --
> > > >> >> >> Ken Slovak
> > > >> >> >> [MVP - Outlook]http://www.slovaktech.com
> > > >> >> >> Author: Professional Programming Outlook 2007
> > > >> >> >> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> > > >> >> >> wrote in message
>
> > > >> >> >>@l1g2000hsa.googlegroups.com...
>
> > > >> >> >> > I've written a macro that will export all of my appointments to
> > > >> >> >> > Excel. With Office 2007, this works fine, but on other computers
> > > >> >> >> > running Office 2003, it does not work. The issue that 2003 does not
> > > >> >> >> > show the recurring items while 2007 does.
>
> > > >> >> >> > The start of my code is this:
>
> > > >> >> >> > Dim SafeAppointment, oAppointment
> > > >> >> >> > Dim olOutlook As Outlook.Application
> > > >> >> >> > Dim nsNameSpace As NameSpace
> > > >> >> >> > Dim mItemCollection As Items
>
> > > >> >> >> > Dim dStart As Date
>
> > > >> >> >> > Dim dDatePlace As Date
> > > >> >> >> > Dim dLastCalendarDate As Date
> > > >> >> >> > Dim bPrintBlanks As Boolean
>
> > > >> >> >> > Dim filter1 As String
> > > >> >> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> > > >> >> >> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
> > > >> >> >> > yy") & "'"
>
> > > >> >> >> > Set olOutlook = CreateObject("Outlook.Application")
> > > >> >> >> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
> > > >> >> >> > Set mItemCollection =
> > > >> >> >> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>
> > > >> >> >> > mItemCollection.Sort "[Start]", False
> > > >> >> >> > mItemCollection.IncludeRecurrences = True
> > > >> >> >> > Set mitem = mItemCollection.Find("[Start] >= '" &
> > > >> >> >> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
> > > >> >> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>
> > > >> >> >> > ' LOOP OF CALENDAR ITEMS
> > > >> >> >> > ***********************************************************************************************************************************************************
> > > >> >> >> > While TypeName(mitem) = "AppointmentItem"
>
> > > >> > Sue, it looks like you mixed up the Start and End in the filter. I
> > > >> > think that would have brought back everything but what we were trying
> > > >> > to pull. Anyway, I swapped it and I'm still having the same issue.
>
> > > >> > I changed the filter to be:
>
> > > >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
> > > >> > yy") & _
> > > >> > "' AND [End] < '" & _
> > > >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>
> > > >> > This had the same results as before. Then I remembered the Find
> > > >> > statement still uses the Start date twice instead of the Start and
> > > >> > End. I switched this up and had the same results.
>
> > > > Yeah, I got confused when I saw it, but it makes sense now.
> > > > Regardless, that didn't solve the issue.
>
> > Thanks. I changed the code and on the line"For Each Item In
> > myItemCollection" it returns the error "Run-time Error 13 Type
> > mismatch"
>
> ok, found that error. The code used mItemCollection and
> myItemCollection ...
That fixed it. Thanks to both of you for your help. |
|
| Back to top |
|
 |
Sue Mosher [MVP-Outlook]
Joined: 12 Aug 2007 Posts: 656
|
Posted: Tue Feb 05, 2008 9:29 pm Post subject: Re: IncludeRecurrences 2003 vs 2007 |
|
|
You might need to fix my typo. I used both myItemCollection and mItemCollection. (Object Explicit is your friend.)
Also:
Dim item as Object -- you don't know it's an AppointmentItem until you check the Class property.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
wrote in message @c4g2000hsg.googlegroups.com...
> On Feb 5, 3:57 pm, "Sue Mosher [MVP-Outlook]"
> wrote:
>> I think the problem is that you're doing filtering twice and using IncludeRecurrences only on the second filter. You only need to filter once:
>>
>> Dim filter1 As String
>> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
>> "' AND [Start] < '" & _
>> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>> Set olOutlook = CreateObject("Outlook.Application")
>> Set nsNameSpace = olOutlook.GetNamespace("MAPI")
>> Set myItems = GetDefaultFolder(olFolderCalendar).Items
>> myItems.Sort "[Start]", False
>> myItems.IncludeRecurrences = True
>> Set mItemCollection = myItems.Restrict(filter1)
>> 'loop
>> For Each item in myItemCollection
>> If item.Class = olAppointment Then
>> ' process item
>> End If
>> Next
>>
>> wrote in message@k39g2000hsf.googlegroups..com...
>> > On Feb 5, 1:22 pm, "Sue Mosher [MVP-Outlook]"
>> > wrote:
>> >> It's not mixed up at all. Think about it: An appointment can lie wholly within the range you want to check, partially overlap it, or completely overlap it. Therefore, if you want all the appointments within a particular range, you need to look for appointments that end after the start of the range and begin before the end of the range. The blog article athttp://weblogs.asp.net/whaggard/archive/2007/03/21/retrieving-your-ou....a good graphic representation for this.
>>
>> >> wrote in message@k2g2000hse.googlegroups.com...
>> >> > On Feb 5, 12:07 pm, "Sue Mosher [MVP-Outlook]"
>> >> > wrote:
>> >> >> Try changing your filter so that it uses both dates and not just the Start date:
>>
>> >> >> filter1 = "[End] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/yy") & _
>> >> >> "' AND [Start] < '" & _
>> >> >> Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>>
>> >> >> wrote in message@d21g2000prf.googlegroups..com...
>> >> >> > Yes, Redemption is installed.
>>
>> >> >> > I don't get any errors at all, but the recurring items are not
>> >> >> > exported. They only time they are exported is if the very first date
>> >> >> > is in the selected date range. It's like the "IncludeRecurrences" is
>> >> >> > being ignored.
>>
>> >> >> > On Feb 5, 9:47 am, "Ken Slovak - [MVP - Outlook]"
>> >> >> > wrote:
>> >> >> >> Is Redemption installed on the Outlook 2003 computer? What errors if any are
>> >> >> >> you getting? Where does the code fail if you step it in Excel?
>>
>> >> >> >> --
>> >> >> >> Ken Slovak
>> >> >> >> [MVP - Outlook]http://www.slovaktech.com
>> >> >> >> Author: Professional Programming Outlook 2007
>> >> >> >> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>>
>> >> >> >> wrote in message
>>
>> >> >> >>@l1g2000hsa.googlegroups.com....
>>
>> >> >> >> > I've written a macro that will export all of my appointments to
>> >> >> >> > Excel. With Office 2007, this works fine, but on other computers
>> >> >> >> > running Office 2003, it does not work. The issue that 2003 does not
>> >> >> >> > show the recurring items while 2007 does.
>>
>> >> >> >> > The start of my code is this:
>>
>> >> >> >> > Dim SafeAppointment, oAppointment
>> >> >> >> > Dim olOutlook As Outlook.Application
>> >> >> >> > Dim nsNameSpace As NameSpace
>> >> >> >> > Dim mItemCollection As Items
>>
>> >> >> >> > Dim dStart As Date
>>
>> >> >> >> > Dim dDatePlace As Date
>> >> >> >> > Dim dLastCalendarDate As Date
>> >> >> >> > Dim bPrintBlanks As Boolean
>>
>> >> >> >> > Dim filter1 As String
>> >> >> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
>> >> >> >> > yy") & "' AND [Start] < '" & Format(frmCalendarPrint.txtEnd, "mm/dd/
>> >> >> >> > yy") & "'"
>>
>> >> >> >> > Set olOutlook = CreateObject("Outlook.Application")
>> >> >> >> > Set nsNameSpace = olOutlook.GetNamespace("MAPI")
>> >> >> >> > Set mItemCollection =
>> >> >> >> > nsNameSpace.GetDefaultFolder(olFolderCalendar).Items.Restrict(filter1)
>>
>> >> >> >> > mItemCollection.Sort "[Start]", False
>> >> >> >> > mItemCollection.IncludeRecurrences = True
>> >> >> >> > Set mitem = mItemCollection.Find("[Start] >= '" &
>> >> >> >> > Format(frmCalendarPrint.txtStart, "mm/dd/yy") & "' AND [Start] < '" &
>> >> >> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'")
>>
>> >> >> >> > ' LOOP OF CALENDAR ITEMS
>> >> >> >> > ***********************************************************************************************************************************************************
>> >> >> >> > While TypeName(mitem) = "AppointmentItem"
>>
>> >> > Sue, it looks like you mixed up the Start and End in the filter. I
>> >> > think that would have brought back everything but what we were trying
>> >> > to pull. Anyway, I swapped it and I'm still having the same issue.
>>
>> >> > I changed the filter to be:
>>
>> >> > filter1 = "[Start] >= '" & Format(frmCalendarPrint.txtStart, "mm/dd/
>> >> > yy") & _
>> >> > "' AND [End] < '" & _
>> >> > Format(frmCalendarPrint.txtEnd, "mm/dd/yy") & "'"
>>
>> >> > This had the same results as before. Then I remembered the Find
>> >> > statement still uses the Start date twice instead of the Start and
>> >> > End. I switched this up and had the same results.
>>
>> > Yeah, I got confused when I saw it, but it makes sense now.
>> > Regardless, that didn't solve the issue.
>
>
> Thanks. I changed the code and on the line"For Each Item In
> myItemCollection" it returns the error "Run-time Error 13 Type
> mismatch"
|
|
| Back to top |
|
 |
|
|
| Related Topics: | Run Outlook Plugin on office 2003,2007 and windowsXP,Vista Hi, i want to develop an outlook plugin in .NET, which can support office 2003,2007 and can run on windows XP and vistan, can anyone help and tell me how is it possible? Thanks & Regards Tanweer
Outlook 2003 and Access 2003 My goal is to add a record to an Access table for each individual email in Outlook. Exporting emails from an Outlook folder to an external file is perfect, except for the date field which is missing from the export. Is there a way to get the date into the
Outlook 2003 VBA I noticed that in the Macro Security dialog that there is an option to set the security level to "Very High". Apparently on macros in a specific location will run. Does anyone have any additional information on this? Also will this disable those lame warn
Outlook 2003 Hi everyone, I'm developing a c# application that needs to replicate data on the calendar of the logged user (with Outlook 2003). I succesfully added a reference to the Outlook com object and created an appointment for the desired date & duration. Anyway
Using XML in outlook 2003 Hi, I need to use XML in outlook cod. How can I do it with outlook 2003 . (if its help- I have vs2003 with framework1.1) Thanks David |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|