Object Error in Outlook Function -
i writing function prints out folder name in debug window. reason when call function object required error. have set object unsure wrong. appreciated. thanks!
function email_function(fldr outlook.folder) debug.print fldr end function sub email() set objoutlook = createobject("outlook.application") set objnspace = objoutlook.getnamespace("mapi") set start_fldr = objnspace.getdefaultfolder(olfolderinbox) debug.print start_fldr if not start_fldr nothing email_function (start_fldr) end if end sub
wrong syntax.
call email_function(fldr) 'or email_function fldr
original code in question:
sub email() dim objoutlook application dim objnspace namespace dim start_fldr folder dim fldr folder set objoutlook = application set objnspace = objoutlook.getnamespace("mapi") set start_fldr = objnspace.getdefaultfolder(olfolderinbox) set fldr = start_fldr.folders.getfirst call email_function(fldr) email_function fldr end sub
Comments
Post a Comment