View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Desmond Walsh Desmond Walsh is offline
external usenet poster
 
Posts: 28
Default Problem with class variable and Personal.xlsb

I have developed a DebugSupport class that replaces using Debug.Print statements for debugging in Excel VBA code development. It gives the option of directing output to Immediate Window or Immediate Window and disk file or disk file only. The disk file is uniquely named and opens/closes as my application runs. This class has a method output_line. So, in my code I replace
Debug.Print "String including Tab() and Spc() "
with
Public dp as New DebugSupport
dp.output_line("String modified to mimic Tab and Spc functionality")

This supports a very useful debugging environment. My problem is with the class variable dp (declared global) and Personal.xlsb. I don't seem to be able to share dp between my app and macros in Personal.xlsb.
My Workbook Personal.xlsb
Main calls Level1macro calls Level2macro

If I open an instance of DebugSupport in Main, dp is unavailable in Level1macro. If I have a class module DebugSupport in both MyWorkbook and Personal then I end up logging to two separate disk files which is not what I want.