Original "start date" of postponed appointment

shir0206

New Member
Joined
Apr 15, 2019
Messages
2
Hello,


Hopefully someone could help :)


I use VBA code that runs through Microsoft Outlook Appointments, and for each appointment - prints a few details - to an Excel table.


If I set the start date of an appointment on "01-April-2019", and then postpone that appointment to "12-April-2019", and then postpone that appointment to "15-April-2019" - I have 3 "Appointment Item" objects in my folder.
I would like to print for each appointment in the folder - the "Start Date" that was set *originally*.
For example: Print for the first appointment - the first original start date (01-April-2019), for the first postponed appointment - the first postponed start date (12-April-2019), and for the second postponed appointment - the second postponed start date (15-April-2019).


However, when I run my code - the *last* "Start Date" is printed (15-April-2019, 15-April-2019, 15-April-2019), instead of the original (01-April-2019, 12-April-2019, 15-April-2019) .


I read a lot about different types of "date" objects, but couldn't find the correct one.


Could anyone help me?


Thank you very much!


Code:
	Sub GetFromOutlook()


	'Early Binding: Tools > References > Microsoft Outlook xx.0 Object Library > OK


	Dim OutlookApp As Outlook.Application
	Dim OutlookNS As Namespace
	Dim Folder As MAPIFolder
	Dim oApp As Outlook.Application
	Dim oG As Outlook.Folder  'Method for IMAP, as used by Gmail.
	Dim oM As Outlook.MeetingItem
	Dim oAA As Outlook.AppointmentItem
	Dim oI As Outlook.RecurrencePattern
	Dim sMsg$, sAdd$
	Dim i As Long
	Dim j As Long


	Set OutlookApp = New Outlook.Application
	Set OutlookNS = OutlookApp.GetNamespace("MAPI")
	Set Folder = OutlookNS.GetDefaultFolder(olFolderInbox).Parent.Folders("CCB Meetings")


  
	 Dim icon As String
  
	  Set oApp = CreateObject("Outlook.Application")
  
	  Set oG = OutlookNS.GetDefaultFolder(olFolderInbox).Parent.Folders("CCB Meetings")
   
	  For i = 1 To oG.Items.Count
 	   If TypeName(oG.Items(i)) = "MeetingItem" Then j = j + 1
	  Next i
	  If j = 0 Then Exit Sub


	' Create titles
	        Range("A1").Offset(0, 0).Value = "SenderName"
	        Range("B1").Offset(0, 0).Value = "Subject"
	        Range("C1").Offset(0, 0).Value = "CreationTime (Scheduled time of the first appointment)"
	        Range("D1").Offset(0, 0).Value = "ReceivedTime (Scheduled time of the current appointment)"
 	       Range("E1").Offset(0, 0).Value = "Start (start time of the last scheduled appointment)"
	        Range("F1").Offset(0, 0).Value = "StartTime (doesnt work yet)"
	        Range("G1").Offset(0, 0).Value = "Location"
	        Range("H1").Offset(0, 0).Value = "RequiredAttendees"
	        Range("I1").Offset(0, 0).Value = "OptionalAttendees"
	        Range("J1").Offset(0, 0).Value = "ResponseStatus"




	  On Error Resume Next
	  j = 0
	  For i = 1 To oG.Items.Count
	      Set oM = oG.Items(i)
 	     With oG.Items(i).GetAssociatedAppointment(True)
 	       j = j + 1
	        Range("A1").Offset(j, 0).Value = oM.SenderName
	        Range("B1").Offset(j, 0).Value = oM.Subject
 	       Range("C1").Offset(j, 0).Value = .CreationTime
	        Range("D1").Offset(j, 0).Value = oM.ReceivedTime
	        Range("E1").Offset(j, 0).Value = .Start
 	       Range("F1").Offset(j, 0).Value = oAA.GetRecurrencePattern '??????????????????
	        Range("G1").Offset(j, 0).Value = .Location
 	       Range("H1").Offset(j, 0).Value = .RequiredAttendees
	        Range("I1").Offset(j, 0).Value = .OptionalAttendees
 	       Range("J1").Offset(j, 0).Value = .ResponseStatus
     
 	     End With
	  Next i
	  On Error GoTo 0




	Set Folder = Nothing
	Set OutlookNS = Nothing
	Set OutlookApp = Nothing


	End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Upvote 0
OK I understood. Im just looking for an answer. Wont do that again.
We are not saying that you cannot do it, we are just saying if you do, mention that you are doing so and provide links to the other posts.
That way others can see what has already been suggested on the other threads, and see if it has already been solved elsewhere, so they don't waste time on suggesting things already suggested, or work on a problem that may have already been solved elsewhere.
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top