Porting the PseudoEventClassCode to a VB 6.0 Project

To port the PseudoEventClassCode to a Visual Basic (VB) 6.0 project, follow these steps:

  • Cut and paste the VBScript code in a class module that you've opened in a new project.
  • Move all the variable declarations to the top of the file.
  • Comment the line that uses the Eval function because VBA doesn't support Eval.
  • Make sure you've explicitly declared the VBScript array arrFile. Using Redim to reinitialize arrays that you haven't explicitly declared causes problems in VB 6.0. Initially declaring arrays with Dim avoids any problems.
  • Copy and insert the code that executes after Class_Initialize to the proper VB handler (still calling this code Class_Initialize) to make VB 6.0 recognize and execute that code. You must sink the event through the VB IDE.

When you’ve completed these steps, the class works in VBA code. You must rethink only one aspect: the event handling. Although VBScript doesn’t natively support events, VB provides a specific programming interface to handle and raise events. Thus, you need to adapt the VBScript code accordingly.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.