VB coding works in OL 2010, but not in OL 2013

Status
Not open for further replies.

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


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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Nothing in the code jumps out at me as being wrong or changed in 2013/2016. (Most macros will work in 2007 and up, especially for features that exist in all versions.)

Do you have scripting enabled for public folders in the Trust center, Email security ?

trust center.png
 

David Michaels

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi Diane,

Thanks for the reply. Yes, I did have it enabled. I just realized that the OL 2013 is also on a Windows 10 machine whereas my other machines are Windows 7 Pro. Do you know of anything Win 10 related that could be involved?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Nothing on 10 should affect it - unless security software is blocking it. I'd be more inclined to say 2013 has a bug that is triggered - there were issues early on with custom forms, but i'm pretty sure all were fixed. (assuming you have the newest builds installed.)

Is the form published?
 
Status
Not open for further replies.
Top