Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Pass a time value from Excel to Outlook appointment

Hi Hope someone can help me out.
I've produced a Macro that sends an appointment to Outlook using the
following code. What I'd like to do is have the appointment time picked up
from a cell rather than TimeValue ("17:00:00). Everytime I change it to
TimeValue ("D14) I get a run time error 13 Type mismatch
Any ideas where I'm going wong!!

Dim olApp As Outlook.Application
Dim olApt As AppointmentItem
Set olApp = New Outlook.Application
Set olApt = olApp.CreateItem(olAppointmentItem)
With olApt
..Start = Sheet4.Range("B14").Value
..End = Sheet4.Range("C14").Value + TimeValue("17:00:00")
..AllDayEvent = True
..Subject = Sheet4.Range("G3") + " " + Sheet4.Range("M14").Value
..Body = Sheet4.Range("O14").Value
..BusyStatus = olFree
..RequiredAttendees = Sheet4.Range("C4") + ", " + Sheet4.Range("B4").Value
..Recipients.ResolveAll
..MeetingStatus = Outlook.OlMeetingStatus.olMeeting
..Save
..Display
..Send
End With
Set olApt = Nothing
Set olApp = Nothing
MsgBox "Your request for leave has been sent to your line manager for
approval.", , "For Information"

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Pass a time value from Excel to Outlook appointment

Try

TimeValue(Range("D14").Text)

HTH,
Bernie
MS Excel MVP


"splodgey" wrote in message
...
Hi Hope someone can help me out.
I've produced a Macro that sends an appointment to Outlook using the
following code. What I'd like to do is have the appointment time picked up
from a cell rather than TimeValue ("17:00:00). Everytime I change it to
TimeValue ("D14) I get a run time error 13 Type mismatch
Any ideas where I'm going wong!!

Dim olApp As Outlook.Application
Dim olApt As AppointmentItem
Set olApp = New Outlook.Application
Set olApt = olApp.CreateItem(olAppointmentItem)
With olApt
.Start = Sheet4.Range("B14").Value
.End = Sheet4.Range("C14").Value + TimeValue("17:00:00")
.AllDayEvent = True
.Subject = Sheet4.Range("G3") + " " + Sheet4.Range("M14").Value
.Body = Sheet4.Range("O14").Value
.BusyStatus = olFree
.RequiredAttendees = Sheet4.Range("C4") + ", " + Sheet4.Range("B4").Value
.Recipients.ResolveAll
.MeetingStatus = Outlook.OlMeetingStatus.olMeeting
.Save
.Display
.Send
End With
Set olApt = Nothing
Set olApp = Nothing
MsgBox "Your request for leave has been sent to your line manager for
approval.", , "For Information"

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Pass a time value from Excel to Outlook appointment

Thanks Bernie worked a treat
Dave

"Bernie Deitrick" wrote:

Try

TimeValue(Range("D14").Text)

HTH,
Bernie
MS Excel MVP


"splodgey" wrote in message
...
Hi Hope someone can help me out.
I've produced a Macro that sends an appointment to Outlook using the
following code. What I'd like to do is have the appointment time picked up
from a cell rather than TimeValue ("17:00:00). Everytime I change it to
TimeValue ("D14) I get a run time error 13 Type mismatch
Any ideas where I'm going wong!!

Dim olApp As Outlook.Application
Dim olApt As AppointmentItem
Set olApp = New Outlook.Application
Set olApt = olApp.CreateItem(olAppointmentItem)
With olApt
.Start = Sheet4.Range("B14").Value
.End = Sheet4.Range("C14").Value + TimeValue("17:00:00")
.AllDayEvent = True
.Subject = Sheet4.Range("G3") + " " + Sheet4.Range("M14").Value
.Body = Sheet4.Range("O14").Value
.BusyStatus = olFree
.RequiredAttendees = Sheet4.Range("C4") + ", " + Sheet4.Range("B4").Value
.Recipients.ResolveAll
.MeetingStatus = Outlook.OlMeetingStatus.olMeeting
.Save
.Display
.Send
End With
Set olApt = Nothing
Set olApp = Nothing
MsgBox "Your request for leave has been sent to your line manager for
approval.", , "For Information"

End Sub




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
Splitting appointment records in to 15 minute time bands The Inquirer Excel Worksheet Functions 4 October 9th 06 02:38 PM
Splitting appointment records in to 15 minute time bands The Inquirer Excel Discussion (Misc queries) 3 October 9th 06 12:30 PM
excel open in outlook if outlook is running kirk Excel Discussion (Misc queries) 0 May 24th 06 06:42 PM
Automatically create outlook appointment Alarmbloke Excel Discussion (Misc queries) 0 March 12th 06 08:47 PM
Create a button in excel that can open an outlook appointment? Movieman Excel Worksheet Functions 1 July 15th 05 12:20 AM


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