Outlook 2013 VBA Public Variable Doesn't Persist -
at top of thisoutlooksession define:
option explicit public vartest long
i have couple of test programs in thisoutlooksession.
using debug run test3 program:
sub test3() vartest = 42 end sub
i run test3b, instead of vartest displaying value of 42, value shows zero.
sub test3b() msgbox vartest end sub
obviously have misconception scope or persistence. doing wrong?
after more searching, found following sue mosher, outlook mvp:
remember thisoutlooksession class module.
you need add @ least 1 regular code module project , declare global variables in it, not in thisoutlooksession, using public keyword instead of plain old dim
sure enough when move public variable definitions module, persistence issue resolved.
Comments
Post a Comment