David Michaels
New Member
- Outlook version
- Outlook 2010 32 bit
- Email Account
- Exchange Server
Hello,
II'm using the following code on a custom form to create a new record in a different public folder with specific information when a command button is pressed. The code has worked fine in Outlook 2010, but it causing Outlook to stop working when used in Outlook 2013. I'm not quite sure what changed between versions, but any recommendations to revising the code would be helpful. Thanks in advance. Dave
II'm using the following code on a custom form to create a new record in a different public folder with specific information when a command button is pressed. The code has worked fine in Outlook 2010, but it causing Outlook to stop working when used in Outlook 2013. I'm not quite sure what changed between versions, but any recommendations to revising the code would be helpful. Thanks in advance. Dave
Code:
Sub CLUpdate_Click()
Dim TempCL
Dim myOLApp
Dim myNS
Dim objfolder
Dim newtitem
Dim conname
Dim constudentid
Dim conprogram
Dim consubprogram
Dim consubmajor
Dim concldate
Dim concltime
Dim conclinitials
Dim conreason
Dim condisposition
Dim connotes
Set TempCL = Item.UserProperties.Find("CallLog")
Set conname = Item.UserProperties.Find("StudentName")
Set constudentid = Item.UserProperties.Find("StudentID")
Set conprogram = Item.UserProperties.Find("Program")
Set consubprogram = Item.UserProperties.Find("Subprogram")
Set consubmajor = Item.UserProperties.Find("Major")
Set concldate = Item.UserProperties.Find("CLDate")
Set concltime = Item.UserProperties.Find("CLTime")
Set conclinitials = Item.UserProperties.Find("CLInit")
Set conreason = Item.UserProperties.Find("CLReason")
Set condisposition = Item.UserProperties.Find("CLDisposition")
Set connotes = Item.UserProperties.Find("CLComment")
Set myOLApp = CreateObject ("Outlook.Application")
Set myNS = myOLApp.GetNamespace("MAPI")
Set objfolder = myNS.GetFolderFromID("0000 <entry ID shortened for forum> FA830000")
Set newtitem = objfolder.items.add()
With newtitem
.FullName = conname
.Account = constudentid
.CompanyName = conprogram
.Department = consubprogram
.Officelocation = consubmajor
.User1 = DateValue(concldate)
.JobTitle = concltime
.AssistantName = conclinitials
.Profession = conreason
.ManagerName = condisposition
.Body = connotes
End With
newtitem.Save
Item.UserProperties.Find("CallLog") = Item.UserProperties.Find("CLSubmit")&TempCL
Item.UserProperties.Find("CLDate") = Now()
Item.UserProperties.Find("CLInit") = ""
Item.UserProperties.Find("CLTime") = ""
Item.UserProperties.Find("CLDisposition") = ""
Item.UserProperties.Find("CLReason") = ""
Item.UserProperties.Find("CLComment") = ""
Item.UserProperties.Find("CLBypass") = ""
Set conname = Nothing
Set constudentid = Nothing
Set conprogram = Nothing
Set consubprogram = Nothing
Set consubmajor = Nothing
Set concldate = Nothing
Set concltime = Nothing
Set conclinitials = Nothing
Set conreason = Nothing
Set condisposition = Nothing
Set connotes = Nothing
End Sub