Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Outlook Calendar code works.... 1 question
Hi all,
I have the following code that adds an calendar appointment to Outlook from excel, it works great however is there a way I can substitute the .Start = Range("B1") & " 1:30:00 PM" part so instead of having to manually add the start and finish time into the code this can link to a cell reference? (the " 1:30:00 PM" bit). Sub AddToOLCalendar1() Dim objOL As Object Dim objItem As Object Dim lngRow As Long Set objOL = CreateObject("Outlook.Application") Sheets("Sheet1").Select lngRow = 4 If ActiveSheet.Cells(lngRow, 2).Text < "" Then Set objItem = objOL.CreateItem(1) ' constant olAppointmentItem = 1 With objItem .Start = Range("B1") & " 1:30:00 PM" .End = Range("B1") & " 5:00:00 PM" .Subject = Range("C1") .Location = Range("F1") .Save End With End If lngRow = lngRow + 1 Set objItem = Nothing Set objOL = Nothing MsgBox " Added to Outlook " End Sub Many thanks for any help or direction. Regards Andy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Outlook Calendar code works.... 1 question
Solved it, hope this helps others!
..Start = Format(Range("D1").Value, "hh:mm AMPM") + _ Format(Range("B1").Value, "mm/dd/yyyy") "Andy the yeti" wrote: Hi all, I have the following code that adds an calendar appointment to Outlook from excel, it works great however is there a way I can substitute the .Start = Range("B1") & " 1:30:00 PM" part so instead of having to manually add the start and finish time into the code this can link to a cell reference? (the " 1:30:00 PM" bit). Sub AddToOLCalendar1() Dim objOL As Object Dim objItem As Object Dim lngRow As Long Set objOL = CreateObject("Outlook.Application") Sheets("Sheet1").Select lngRow = 4 If ActiveSheet.Cells(lngRow, 2).Text < "" Then Set objItem = objOL.CreateItem(1) ' constant olAppointmentItem = 1 With objItem .Start = Range("B1") & " 1:30:00 PM" .End = Range("B1") & " 5:00:00 PM" .Subject = Range("C1") .Location = Range("F1") .Save End With End If lngRow = lngRow + 1 Set objItem = Nothing Set objOL = Nothing MsgBox " Added to Outlook " End Sub Many thanks for any help or direction. Regards Andy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel and outlook calendar | Excel Discussion (Misc queries) | |||
how do i export excel calendar info to outlook calendar? | Excel Discussion (Misc queries) | |||
dates from excel onto outlook calendar | Excel Discussion (Misc queries) | |||
Extracting from Outlook Calendar to Excel | Excel Programming | |||
import calendar items from excel into outlook calendar | Excel Discussion (Misc queries) |