PDA

View Full Version : custom form causing outlook to crash



wingers
10-02-2013, 12:23 PM
Hi
I have a custom form I have been using for years without a problem - but since latest updates to outlook 2013 it now crashes outlook without a useful error everytime I use it

It contains the code below, so when a date is changed in a drop down it then adds something to the calendar

any ideas why it now suddenly won't work and crashes outlook?


Sub Item_CustomPropertyChange(ByVal Name)
Const olAppointmentItem = 1
Select Case Name
Case "Email Support expires"
Set myAppt = Application.CreateItem(olAppointmentItem)
myAppt.Start = Item.UserProperties("Email Support expires")
myAppt.Subject="Email Support expires - " & Item.FullName
myAppt.AllDayEvent = 1
myAppt.ReminderSet = True
myAppt.ReminderMinutesBeforeStart = 10080
myAppt.Save
Case "Web Hosting expires"
Set myAppt = Application.CreateItem(olAppointmentItem)
myAppt.Start = Item.UserProperties("Web Hosting expires")
myAppt.Subject="Web Hosting expires - " & Item.FullName
myAppt.AllDayEvent = 1
myAppt.ReminderSet = True
myAppt.ReminderMinutesBeforeStart = 10080
myAppt.Save
End Select
End Sub

SamT
10-02-2013, 03:57 PM
myAppt is not declared in the sub you shared. That tells me that you might not be using "Option Explicit" in your code.

Put Option Explicit as the first line in the Code page, then, use the debug menu to Compile the project. You will have to add the line "Dim myAppt" to that sub.

If that doesn't find the error, comment out any "OnError Goto" lines and any "Display alerts = False" lines in the Project, then run the App and see if you get any error reports.

To troubleshoot the sub you posted, set a BreakPoint at the sub declaration line and run the App. It will stop execution when it gets to that sub, then press F8 to step thru the sub. Note that the yellow highlighted line is the next line to execute.

wingers
10-02-2013, 04:10 PM
Okay thanks - the logic makes sense, but not sure how I can do most of what you say as this is not done in Visual Studio etc - the code is just entered in the view code area accessed via developer tab of the form in outlook, so not sure how I can do what you say?

And it has been working fine for years with outlook 2003, 2007, 2010 and 2013 up until about a week ago

wingers
10-08-2013, 06:42 AM
form attached - in case it helps someone help me find out why not working?

10672