vba - Visual Basic Run-time error '91' when setting new Object -


i'm relatively new vba, not programming. i'm trying set shared instance of class, , keep running run-time error 91, complains variable not being set.

'a module acts singleton loader option explicit private instance grocerydatabase  public function sharedinstance() grocerydatabase     if instance nothing         set instance = new grocerydatabase 'run-time error 91 thrown here     end if      set sharedinstance = instance end function 

obviously variable isn't set yet, why i'm assigning new grocerydatabase. i've seen lot of answers question boil down attempting use nothing object, can't understand why being thrown when try instantiate it.

the error not due line object instantiated, instead because of issue in constructor there in fact variable being assigned not set.

this discovered putting breakpoint in constructor grocerydatabase. future, i've enabled "break in class modules", found in path tools>options>general. now, issue pinpointed when pressing "debug" button.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -