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
 
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
 
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?
 
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.
Similar threads
Thread starter Title Forum Replies Date
D Inbox column color coding Using Outlook 2
G Outlook 2010 VBA Coding Assistance please! Outlook VBA and Custom Forms 5
B Sub Calendar-Color Coding Issue Using Outlook 4
Z Outlook account subfolders - Outlook VB coding Using Outlook 8
F Color Coding Emails - Outlook 2007 SP-3 Using Outlook 1
M VBA coding Outlook VBA and Custom Forms 3
W Outlook Coding - Select different email adresses to send from Outlook VBA and Custom Forms 5
G wrong body .msg coding Outlook VBA and Custom Forms 6
E Save Selected Email Message as .msg File - digitally sign email doesn't works Outlook VBA and Custom Forms 1
P Outlook 2013 search no longer works Using Outlook 2
KeithJB iCloud calendar sync only works one way! Using Outlook 3
V Outlook 2021 Outlook-2021 (64-bit) and iCloud-for-Windows v13.0 - It Works Good. Using Outlook 12
B Outlook 2016 Unable to view images or logos on the outlook 2016 emails the same html code works well when i use outlook 2010 Using Outlook 0
A Manually Building DisplayName <emailaddr> No Longer Works Using Outlook 0
N .StartDate & .EndDate Only Works Sometimes Outlook VBA and Custom Forms 1
U Keyboard Remapper no longer works in Outlook Using Outlook 1
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
R Email account works on thunderbird not Outlook Using Outlook 6
T 2 mostly identical scripts, only one works Using Outlook 16
D Default Send Account that Works? Using Outlook 0
J Cached mode no longer works with NTLM authentication Exchange Server Administration 0
S my vbscript button1_click code works on appointment created but not on opening an existing apntmn Outlook VBA and Custom Forms 16
R SEARCH PEOPLE - would like one that really works Using Outlook 1
B Display of Sending Account in Outlook 2007 no longer works Using Outlook 2
S Outlook no longer works with Yahoo Mail Using Outlook 9
E Need a bit of education on how Outlook works please Using Outlook 3
P Outlook works, but freezes when trying to use calender v2007 (vista prof) Using Outlook 1
B Outlook connector only works when set to default Using Outlook.com accounts in Outlook 5
H Two accounts, Junk email filter only works on one account, office 2010, pop3 Using Outlook 5
D VBA Macro Works in 2007 but errors in 2010 Using Outlook 2
X Outlook 2010 - search works on one system but not other - identical configurat Using Outlook 2
N Filter end date works differently in OL'07/OL'10 vs OL'03? Hello?! Using Outlook 12
M Attachments cannot be opened in Outlook, OWA works fine Using Outlook 2
J Outlook Connector only works for a day?! Using Outlook.com accounts in Outlook 3
R Password not accepted but works when saved. Using Outlook 3
T Unable to edit Distribution Group membership via Outlook (works via ECP). Exchange Server Administration 7
J Unable to access public folders in Outlook 2007 on Exchange 2010. OWA PF works fine Using Outlook 7
R BCM works, but everything else stopped working BCM (Business Contact Manager) 1
D Using VBA to send Word document as body of message works in 2007, but not in 2003 Outlook VBA and Custom Forms 9
T Works in Word but not Outlook. Plz Help! Outlook VBA and Custom Forms 1
C Copy email to different folder, works in 2003 but not 2007 Outlook VBA and Custom Forms 3
B Email Autolink Works Sporadically BCM (Business Contact Manager) 2
P Moving from 2010 to 365 Using Outlook 3
S Adding a recipient's column to Sent folder in Outlook 2010 Outlook VBA and Custom Forms 1
M Upgrading from: MS Office Professional Plus 2010 to: MS Office Professional Plus 2021 Using Outlook.com accounts in Outlook 16
T Outlook 2010 Cannot edit Calendar entries in OL 2010. Using Outlook 1
e_a_g_l_e_p_i Can emails from Gmail be deleted when they are downloaded to Outlook 2010 Using Outlook 1
H Stationery using between OL 2019 and OL 2010 Using Outlook 0
L Outlook 2010 Outlook 2010 Outlook VBA and Custom Forms 2
C What folders are needed when reinstalling Outlook 2010 Using Outlook 0

Similar threads

Back
Top