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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -