title: What is a public object module in VBA?
body: <p>I'm trying to get as close to function pointers / abstract classes as I can in VBA.  </p>
  
  <p>I have a class called <code>VerificationManager</code> and verifies a bunch of cells in a couple of spreadsheets match up.  This will be done in different ways depending on the information and spreadsheets being used with it.</p>
  
  <p>I'd like to be able to make the code reusable by specifying a method to be called in a string using the <code>Application.Run</code> function.  So I can rewrite the function that changes.</p>
  
  <p>Now if I was using Java or C# I would be able to extend an abstract class and rewrite the internals to the function.  If I was using JavaScript I could store a function in a variable and pass the variable to the class and call it from there.</p>
  
  <p>Inside my class I have a public property called "verificationModule" which I set to the name of the function I want it to call.  </p>
  
  <pre><code>Sub VerifyWorkLocations(empLoc As EmployerLocation)
  ...
      For i = 0 To empLoc.numOfEmp
          Application.Run verificationModule, empLoc.taxdescmatch, empLoc.employees(i)
      Next i
  ...
  End Sub
  </code></pre>
  
  <p>However, when I try to call <code>Application.Run</code> I receive the following error:</p>
  
  <blockquote>
    <p>Compile Error: </p>
    
    <p>"Only user-defined types defined in public object modules can be
    coerced to or from a variant or passed to late-bound functions"</p>
  </blockquote>
  
  <p>I already tried placing my User Defined Types in a <code>Class Module</code> but it basically said that a class module was the wrong place for a type.</p>