home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,580 of 10,840   
   Dikkie Dik to Peter   
   Re: Help - runtime error 91 - object var   
   22 Jun 05 22:45:23   
   
   From: nospam@nospam.org   
      
   Peter wrote:   
   > I have a program which was working fine.   
   > In it a function works out the number of .jpg files in a specified folder.   
   > I then realised that I needed to make sure the folder exists first & added   
   > the code for this.   
   > After this I get the Runtime Error 91 - Object variable not set.   
   > I've rem'd out my added code to no avail.  Tried rebooting to.   
   > The earlier exe version of the program continues to work OK.   
   > The code in question is shown below.  I'd appriciate any advice on how I've   
   > messed this up & how to fix it   
   > I'm running VB6 on XP pro SP2   
   > mstrFolder is declared at the module level and Quickwatch shows it's   
   > contents are a valid path.   
   >   
   > many thanks   
   >   
   >   
      
   Dim objFSO As Object, objFolder As Object   
   Dim objFiles As Object, objFile As Object   
      
   Set objFolder = objFSO.GetFolder(mstrFolder)    ' ---- The error occurs at   
   this line ---   
      
   So that's where it occurs. objFSO is not set and is still Nothing.   
   Therefore, it does not have a GetFolder method and raises an error.   
   I don't know why you are using late binding, but you can set objFSO to a   
   filesystem object by using the new keyword or the CreateObject function.   
      
   Best regards   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca