Adding VBA Reference in QC Post Processing Script



  • I have a VBA script which i want to run in the post processing section of the QC 11 Excel Reports generator (using the UI, not the API). This script uses the Dictionary object in the Microsoft.Scripting reference. When designing it in Excel, i add the reference via Tools->References.

    How can this be achieved in QC?



  • Adding references implies early binding. But early binding is not necessary to use any component registered in the COM registry.

    You can just use the CreateObject function to get back a late-bound reference to the object. It's not pretty, but it works.

    You just need to know the fully qualified name of the object. I'm assuming that here it's Microsoft.Scripting.Dictionary.

    So instead of

    Dim x As New Dictionary (with an Early Bound Reference to Microsoft.Scripting)

    use

    Dim x As Object
    Set x = CreateObject("Microsoft.Scripting.Dictionary")
    

    This is not specific to QC/ALM, or even QA, by the way. This is a generic concept that applies in various ways to any COM-enabled programming environment, including VBA, VB6, VBScript, C++, or even .NET. See the article on early vs. late bound here.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2