Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel and outlook calendar Laurie Excel Discussion (Misc queries) 1 March 30th 09 05:11 AM
how do i export excel calendar info to outlook calendar? Maggie Excel Discussion (Misc queries) 1 December 31st 07 10:27 PM
dates from excel onto outlook calendar maureen Excel Discussion (Misc queries) 0 March 23rd 07 05:55 PM
Extracting from Outlook Calendar to Excel WD Excel Programming 0 April 19th 06 04:58 PM
import calendar items from excel into outlook calendar jsewaiseh Excel Discussion (Misc queries) 0 September 2nd 05 03:53 PM


All times are GMT +1. The time now is 12:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"