Prev: unable to cast ..Excel.ApplicationClass to ..Excel._Application
Next: very urgent : to write the value of next column of the same row
From: Dan Wood on 27 Apr 2010 10:22 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.
From: Jacob Skaria on 28 Apr 2010 03:22
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. |