VBA Access - Opening Outlook to get current user name causes error -


i had been using below code month or so, has started throw error. it's called access module current user's full name. when runs give error 287 (application-defined or object-defined error)

set app = createobject("outlook.application") set ses = app.getnamespace("mapi") strfullname = ses.currentuser.name  **stops @ line** set app = nothing set ses = nothing strfirst = mid(strfullname, instr(1, strfullname, ",") + 1) strlast = left(strfullname, instr(1, strfullname, ",") - 1) fncgetidname = strfirst & " " & strlast 

i've figured out code errors if don't have outlook open. (which why thought worked originally) after going debug, adding watch 'app' or 'ses' hitting run causes work, , continue work untill db restarted. assume has outlook not opening or initializing or something. tried search other issues couldn't find similiar problems, ideas appreciated.

try add ses.logon before retrieving user name.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -