Excel to Outlook Question/Code

zoog25

Active Member
Joined
Nov 21, 2011
Messages
418
Hello All,

Here is my questions / situation. I'm currently working on an excel spreadsheet that has a date of when a document is filed. Once the date is entered, i have a macro that inputs an appointment into my outlook calendar.

Now here is what i need to do. Based on information located on the sheet, i need to have it add the appointment to a shared calendar called "NOC Calendar". The second thing is, based on who is assigned to the document. Can a reminder just be set for that person? Not sure how it is done.

Here is the code i'm using:
Code:
Option Explicit


Sub AddToOutlook(rw)




Dim OL As Outlook.Application
Dim olAppt As Outlook.AppointmentItem
Dim NS As Outlook.Namespace
Dim oFolder As Outlook.Folder
Dim oRecipient As Outlook.Recipient
Dim sSubject As String, sBody As String, sLocation As String
Dim dStartTime As Date, dEndTime As Date
Dim bOLOpen As Boolean
Dim TPws As Worksheet


Set TPws = ThisWorkbook.Worksheets("Tract Parcels")


'Checks to see if Outlook is open and either open and closes it or leaves it open
On Error Resume Next
Set OL = GetObject(, "Outlook.Application")
bOLOpen = True




If OL Is Nothing Then
    Set OL = CreateObject("Outlook.Application")
        bOLOpen = False
End If


'Labor and Materials Appointment Set


sSubject
sLocation = Desk
    
dStartTime = TPws.Cells(rw, "AB").Value + #8:00:00 AM#
dEndTime = TPws.Cells(rw, "AB").Value + #8:30:00 AM#


Set olAppt = OL.CreateItem(olAppointmentItem)
    olAppt.Subject = sSubject
    olAppt.Location = sLocation
    olAppt.Start = dStartTime
    olAppt.End = dEndTime
    olAppt.ReminderSet = True
    olAppt.MeetingStatus = olMeeting
    olAppt.RequiredAttendees = "xxxx@xxxxx.com"
    olAppt.Send
    olAppt.Close olSave
     


If bOLOpen = False Then OL.Quit




End Sub

Now this code is based on an old project that i worked on that i have modified so i'm not sure if the code works or not but i wanted to see how one i assign the appointments to the "NOC Calendar" and then just set the reminder to one person.

The person's name is on corresponding column "B".

Thank you for any help.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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