#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Creating Appointment

Is it possible to create an appointment within Outlook using Excel?

The sheet will have a date when passwords expire, and this will be changed
each month. Is there a macro to look at this date and then create an
appointment within the Outlook calendar to say something along the lines of
'Change Password for system xxxxxxxxx' where xxxxxxxxx will be the data in
field A1

Thanks for your help
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Creating Appointment

With system number in cell A1 and date in cell B1; try the below macro

Sub OLApp()

Dim objOL As Object, objApp As Object
Set objOL = CreateObject("Outlook.Application")

Set objApp = objOL.CreateItem(1)
With objApp
.Subject = "Change Password for system" & Range("A1")
.Start = Range("B1")
.ReminderPlaySound = True
.Save
End With

Set objOL = Nothing
End Sub

--
Jacob (MVP - Excel)


"Dan Wood" wrote:

Is it possible to create an appointment within Outlook using Excel?

The sheet will have a date when passwords expire, and this will be changed
each month. Is there a macro to look at this date and then create an
appointment within the Outlook calendar to say something along the lines of
'Change Password for system xxxxxxxxx' where xxxxxxxxx will be the data in
field A1

Thanks for your help

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Creating Appointment

I have tried that and getting the following error:-

Object doesn't support this property or method (Error 438)

I ran the macro once fine, then it came up with this error. No appointment
went into the calendar either.

Thanks
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Creating Appointment

I tried this with my outlook instance open.

--
Jacob (MVP - Excel)


"Dan Wood" wrote:

I have tried that and getting the following error:-

Object doesn't support this property or method (Error 438)

I ran the macro once fine, then it came up with this error. No appointment
went into the calendar either.

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Creating Appointment

There is no error this time but i cannot find them in the calendar. Is it
anything to do with formatiing the date cell?
Sorry to be a pain!


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Creating Appointment

Cell B1 of activesheet contains a valid date in excel date format.

--
Jacob (MVP - Excel)


"Dan Wood" wrote:

There is no error this time but i cannot find them in the calendar. Is it
anything to do with formatiing the date cell?
Sorry to be a pain!

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Creating Appointment

How stupid can i be!! The date wasn't formatted correctly.

Thank you for that. Next question is:-

How can i set this macro to perform the same actions for multiple cells? So
if coloum A had a list of system names, and coloum B has a list of various
dates, how can the macro scroll down and create the appointments?
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Creating Appointment

Dan, try the below.........

Sub OLApp()

Dim objOL As Object, objApp As Object, lngRow As Long

Set objOL = CreateObject("Outlook.Application")

For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
Set objApp = objOL.CreateItem(1)
With objApp
.Subject = "Change Password for system" & Range("A" & lngRow)
.Start = Range("B" & lngRow)
.ReminderPlaySound = True
.Save
End With
Next

Set objOL = Nothing
End Sub


--
Jacob (MVP - Excel)


"Dan Wood" wrote:

How stupid can i be!! The date wasn't formatted correctly.

Thank you for that. Next question is:-

How can i set this macro to perform the same actions for multiple cells? So
if coloum A had a list of system names, and coloum B has a list of various
dates, how can the macro scroll down and create the appointments?

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Creating Appointment

That works perfectly. Thanks

Is there a way to stop this creating duplicate appointments? Prehaps a
seperate macro to either check if the appointment is there, or prehaps a new
field to say the appointment has been added, and the macro to skip it, eg if
field c1 says 'Done' move onto the next field
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Creating Appointment

Modified...

Sub OLApp()

Dim objOL As Object, objApp As Object, lngRow As Long

Set objOL = CreateObject("Outlook.Application")

For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Range("C" & lngRow) = "" Then
Set objApp = objOL.CreateItem(1)
With objApp
.Subject = "Change Password for system" & Range("A" & lngRow)
.Start = Range("B" & lngRow)
.ReminderPlaySound = True
.Save
End With
Range("C" & lngRow) = "Done"
End If
Next

Set objOL = Nothing
End Sub



--
Jacob (MVP - Excel)


"Dan Wood" wrote:

That works perfectly. Thanks

Is there a way to stop this creating duplicate appointments? Prehaps a
seperate macro to either check if the appointment is there, or prehaps a new
field to say the appointment has been added, and the macro to skip it, eg if
field c1 says 'Done' move onto the next field



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Creating Appointment

I have amended the script slightly to fit in with the fields that i will be
using but am getting a run time 13 error.

My amended script is:-

Sub OLApp()

Dim objOL As Object, objApp As Object, lngRow As Long

Set objOL = CreateObject("Outlook.Application")

For lngRow = 9 To Cells(Rows.Count, "A").End(xlUp).Row
If Range("E" & lngRow) = "" Then
Set objApp = objOL.CreateItem(1)
With objApp
..Subject = "Change Password for system" & Range("A" & lngRow)
..Start = Range("B" & lngRow)
..ReminderPlaySound = True
..Save
End With
Range("E" & lngRow) = "Done"
End If
Next

Set objOL = Nothing
End Sub


So the system name is in colum A starting from cell 9, then the date is
starting from D9, then the field to say the appointment has been added will
be E9.
  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Creating Appointment

I dont see any reason why this should give an error. Let me know which line
is giving this error.

--
Jacob (MVP - Excel)


"Dan Wood" wrote:

I have amended the script slightly to fit in with the fields that i will be
using but am getting a run time 13 error.

My amended script is:-

Sub OLApp()

Dim objOL As Object, objApp As Object, lngRow As Long

Set objOL = CreateObject("Outlook.Application")

For lngRow = 9 To Cells(Rows.Count, "A").End(xlUp).Row
If Range("E" & lngRow) = "" Then
Set objApp = objOL.CreateItem(1)
With objApp
.Subject = "Change Password for system" & Range("A" & lngRow)
.Start = Range("B" & lngRow)
.ReminderPlaySound = True
.Save
End With
Range("E" & lngRow) = "Done"
End If
Next

Set objOL = Nothing
End Sub


So the system name is in colum A starting from cell 9, then the date is
starting from D9, then the field to say the appointment has been added will
be E9.

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
Macro to create outlook appointment Dan Wood Excel Discussion (Misc queries) 2 March 4th 10 01:31 PM
Appointment Calendar.xlt help Ernie Lippert[_2_] Excel Discussion (Misc queries) 3 June 5th 09 02:15 AM
Linking appointment dates JayDee Excel Worksheet Functions 0 July 24th 08 05:10 PM
Automatically create outlook appointment Alarmbloke Excel Discussion (Misc queries) 0 March 12th 06 08:47 PM
Appointment Card Template stewsutherland New Users to Excel 3 January 10th 05 06:13 PM


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