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

VBA: Outlook appointement macro problem



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 5th 09, 07:51 AM posted to microsoft.public.outlook.program_vba
masani paresh[_2_]
external usenet poster
 
Posts: 84
Default VBA: Outlook appointement macro problem

Hi Friends,

We have almost done with the macro and it is working fine on some
*machines.* We have one question. Could you please help on this and we are
done.
On some machine below portion of code works in strenge manner.

For Each olkAppt In olkThisSeries
MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Next


The olkAppt.Start time returns always the date and time of first meeting and
hence this loop goes in infinite loop. What could be the reason here? We also
tried below code but no luck. Please note that it happens only on some
machine while working on another machines.

Do While True

MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Set olkAppt = olkThisSeries.GetNext

Loop

Thanks in advanced
Ads
  #2  
Old February 5th 09, 09:25 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default VBA: Outlook appointement macro problem


What is olkThisSeries?

--
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, 4 Feb 2009 22:51:30 -0800 schrieb masani paresh:

Hi Friends,

We have almost done with the macro and it is working fine on some
*machines.* We have one question. Could you please help on this and we are
done.
On some machine below portion of code works in strenge manner.

For Each olkAppt In olkThisSeries
MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Next


The olkAppt.Start time returns always the date and time of first meeting

and
hence this loop goes in infinite loop. What could be the reason here? We

also
tried below code but no luck. Please note that it happens only on some
machine while working on another machines.

Do While True

MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Set olkAppt = olkThisSeries.GetNext

Loop

Thanks in advanced

  #3  
Old February 9th 09, 06:02 AM posted to microsoft.public.outlook.program_vba
masani paresh[_2_]
external usenet poster
 
Posts: 84
Default VBA: Outlook appointement macro problem

It is a object of selected recurring meeting series.

Please refer below complete code: (It works on some machine but not others
because of problem mentioned in main thread)

Sub ApptWithNotesOnDelete()

Dim olkOldAppt As Outlook.AppointmentItem, _
olkItems As Outlook.Items, _
olkThisSeries As Outlook.Items, _
olkNewAppt As Outlook.AppointmentItem

Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set olkOldAppt = Application.ActiveExplorer.Selection(1)
Case "Inspector"
Set olkOldAppt = Application.ActiveInspector.CurrentItem
End Select

Set olkItems = Session.GetDefaultFolder(olFolderCalendar).Items
olkItems.Sort "[Start]"
olkItems.IncludeRecurrences = True

Set olkThisSeries = olkItems.Restrict("[Subject] = '" &
olkOldAppt.Subject & "'")

For Each olkAppt In olkThisSeries
If Date DateValue(olkAppt.Start) Then Exit For
Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With
Next
olkOldAppt.Delete

Set olkNewAppt = Nothing
Set olkThisSeries = Nothing
Set olkItems = Nothing
Set olkOldAppt = Nothing
End Sub

Thanks,
Paresh
"Michael Bauer [MVP - Outlook]" wrote:


What is olkThisSeries?

--
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, 4 Feb 2009 22:51:30 -0800 schrieb masani paresh:

Hi Friends,

We have almost done with the macro and it is working fine on some
*machines.* We have one question. Could you please help on this and we are
done.
On some machine below portion of code works in strenge manner.

For Each olkAppt In olkThisSeries
MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Next


The olkAppt.Start time returns always the date and time of first meeting

and
hence this loop goes in infinite loop. What could be the reason here? We

also
tried below code but no luck. Please note that it happens only on some
machine while working on another machines.

Do While True

MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Set olkAppt = olkThisSeries.GetNext

Loop

Thanks in advanced


  #4  
Old February 9th 09, 06:05 AM posted to microsoft.public.outlook.program_vba
masani paresh[_2_]
external usenet poster
 
Posts: 84
Default VBA: Outlook appointement macro problem

Thanks for reply Michael.

It is a object of selected recurring meeting. Please refer below complete
macro. It works on some machine and not on others because of problem
mentioned in main thread.

Sub ApptWithNotesOnDelete()

Dim olkOldAppt As Outlook.AppointmentItem, _
olkItems As Outlook.Items, _
olkThisSeries As Outlook.Items, _
olkNewAppt As Outlook.AppointmentItem

Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set olkOldAppt = Application.ActiveExplorer.Selection(1)
Case "Inspector"
Set olkOldAppt = Application.ActiveInspector.CurrentItem
End Select

Set olkItems = Session.GetDefaultFolder(olFolderCalendar).Items
olkItems.Sort "[Start]"
olkItems.IncludeRecurrences = True

Set olkThisSeries = olkItems.Restrict("[Subject] = '" &
olkOldAppt.Subject & "'")

For Each olkAppt In olkThisSeries
If Date DateValue(olkAppt.Start) Then Exit For
Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With
Next
olkOldAppt.Delete

Set olkNewAppt = Nothing
Set olkThisSeries = Nothing
Set olkItems = Nothing
Set olkOldAppt = Nothing
End Sub

Thanks,
Paresh

"Michael Bauer [MVP - Outlook]" wrote:


What is olkThisSeries?

--
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, 4 Feb 2009 22:51:30 -0800 schrieb masani paresh:

Hi Friends,

We have almost done with the macro and it is working fine on some
*machines.* We have one question. Could you please help on this and we are
done.
On some machine below portion of code works in strenge manner.

For Each olkAppt In olkThisSeries
MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Next


The olkAppt.Start time returns always the date and time of first meeting

and
hence this loop goes in infinite loop. What could be the reason here? We

also
tried below code but no luck. Please note that it happens only on some
machine while working on another machines.

Do While True

MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Set olkAppt = olkThisSeries.GetNext

Loop

Thanks in advanced


  #5  
Old February 9th 09, 07:58 AM posted to microsoft.public.outlook.program_vba
masani paresh[_2_]
external usenet poster
 
Posts: 84
Default VBA: Outlook appointement macro problem

Michael,

I got the solution for why it wasn't work on other machine. The problem was
missing of Microsoft Form Library. I have added in COM libraries.

I have one question I am using below statement in my macro:

Set redNewAppt = CreateObject("Redemption.SafeAppointmentItem").

This trows "ActivaX component can't create object" error.

While searching on net I found that it required redeption.dll and I included
it in COM libraries but still no luck. Could you please tell me what could be
wrong here?


Thanks,
Paresh




"masani paresh" wrote:

It is a object of selected recurring meeting series.

Please refer below complete code: (It works on some machine but not others
because of problem mentioned in main thread)

Sub ApptWithNotesOnDelete()

Dim olkOldAppt As Outlook.AppointmentItem, _
olkItems As Outlook.Items, _
olkThisSeries As Outlook.Items, _
olkNewAppt As Outlook.AppointmentItem

Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set olkOldAppt = Application.ActiveExplorer.Selection(1)
Case "Inspector"
Set olkOldAppt = Application.ActiveInspector.CurrentItem
End Select

Set olkItems = Session.GetDefaultFolder(olFolderCalendar).Items
olkItems.Sort "[Start]"
olkItems.IncludeRecurrences = True

Set olkThisSeries = olkItems.Restrict("[Subject] = '" &
olkOldAppt.Subject & "'")

For Each olkAppt In olkThisSeries
If Date DateValue(olkAppt.Start) Then Exit For
Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With
Next
olkOldAppt.Delete

Set olkNewAppt = Nothing
Set olkThisSeries = Nothing
Set olkItems = Nothing
Set olkOldAppt = Nothing
End Sub

Thanks,
Paresh
"Michael Bauer [MVP - Outlook]" wrote:


What is olkThisSeries?

--
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, 4 Feb 2009 22:51:30 -0800 schrieb masani paresh:

Hi Friends,

We have almost done with the macro and it is working fine on some
*machines.* We have one question. Could you please help on this and we are
done.
On some machine below portion of code works in strenge manner.

For Each olkAppt In olkThisSeries
MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Next


The olkAppt.Start time returns always the date and time of first meeting

and
hence this loop goes in infinite loop. What could be the reason here? We

also
tried below code but no luck. Please note that it happens only on some
machine while working on another machines.

Do While True

MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Set olkAppt = olkThisSeries.GetNext

Loop

Thanks in advanced


  #6  
Old February 9th 09, 06:58 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default VBA: Outlook appointement macro problem



Does CreateObject work with other objects? If so, it's possible that you
have renamed the Redemption objects.

--
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 Sun, 8 Feb 2009 22:58:01 -0800 schrieb masani paresh:

Michael,

I got the solution for why it wasn't work on other machine. The problem

was
missing of Microsoft Form Library. I have added in COM libraries.

I have one question I am using below statement in my macro:

Set redNewAppt = CreateObject("Redemption.SafeAppointmentItem").

This trows "ActivaX component can't create object" error.

While searching on net I found that it required redeption.dll and I

included
it in COM libraries but still no luck. Could you please tell me what could

be
wrong here?


Thanks,
Paresh




"masani paresh" wrote:

It is a object of selected recurring meeting series.

Please refer below complete code: (It works on some machine but not

others
because of problem mentioned in main thread)

Sub ApptWithNotesOnDelete()

Dim olkOldAppt As Outlook.AppointmentItem, _
olkItems As Outlook.Items, _
olkThisSeries As Outlook.Items, _
olkNewAppt As Outlook.AppointmentItem

Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set olkOldAppt = Application.ActiveExplorer.Selection(1)
Case "Inspector"
Set olkOldAppt = Application.ActiveInspector.CurrentItem
End Select

Set olkItems = Session.GetDefaultFolder(olFolderCalendar).Items
olkItems.Sort "[Start]"
olkItems.IncludeRecurrences = True

Set olkThisSeries = olkItems.Restrict("[Subject] = '" &
olkOldAppt.Subject & "'")

For Each olkAppt In olkThisSeries
If Date DateValue(olkAppt.Start) Then Exit For
Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With
Next
olkOldAppt.Delete

Set olkNewAppt = Nothing
Set olkThisSeries = Nothing
Set olkItems = Nothing
Set olkOldAppt = Nothing
End Sub

Thanks,
Paresh
"Michael Bauer [MVP - Outlook]" wrote:


What is olkThisSeries?

--
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, 4 Feb 2009 22:51:30 -0800 schrieb masani paresh:

Hi Friends,

We have almost done with the macro and it is working fine on some
*machines.* We have one question. Could you please help on this and we

are
done.
On some machine below portion of code works in strenge manner.

For Each olkAppt In olkThisSeries
MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Next


The olkAppt.Start time returns always the date and time of first

meeting
and
hence this loop goes in infinite loop. What could be the reason here?

We
also
tried below code but no luck. Please note that it happens only on some
machine while working on another machines.

Do While True

MsgBox Date & " " & DateValue(olkAppt.Start)

If Date DateValue(olkAppt.Start) Then Exit Do

Set olkNewAppt = Application.CreateItem(olAppointmentItem)
With olkNewAppt
.Start = olkAppt.Start
.End = olkAppt.End
.Subject = olkAppt.Subject
.Body = olkAppt.Body
.Location = olkAppt.Location
.ReminderSet = olkAppt.ReminderSet
.BusyStatus = olkAppt.BusyStatus
.Save
End With

Set olkAppt = olkThisSeries.GetNext

Loop

Thanks in advanced

 




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
Copying Appointement Martin Racette Outlook - Calandaring 0 February 22nd 08 06:35 PM
Setup appointement for next week but always brings today's date Benoit Lesage Outlook - Calandaring 6 October 30th 07 03:10 PM
Can you see when you submitted a new appointement? Anne-Mette Outlook - Calandaring 2 May 17th 07 02:27 PM
Outlook 2000 Macro problem - Please help [email protected] Outlook and VBA 1 May 16th 07 05:40 PM
Outlook Macro problem Victor Delta Outlook and VBA 2 December 9th 06 07:12 PM


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