Re: Visual basic Locals Window
- From: JE McGimpsey <jemcgimpsey@xxxxxxxx>
- Date: Sat, 22 Aug 2009 00:57:34 -0600
In article <59b7aa0f.-1@xxxxxxxxxxxxxxxxxxxxxxx>,
Theodore_MH@xxxxxxxxxxxxxxxx wrote:
Version: 2004
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel
In the Windows versions of Excel the VB editor has a feature called the
Locals Window which is a great help for analyzing executing code. It displays
all declared variables, range contents, array contents, etc.
I can't find this in Excel 2004's VB Editor. Is the feature just not
available in 2004? Assuming it's not...is there something that offers similar
functionality?
That's something that was not updated in the MacOffice VB Editor (which
essentially stopped development with XL98).
I do the majority of my development in XL04, and I do it old school - I
use breakpoints and manually enter Debug.Print statements into the
Immediate window.
When I have significant development to do, I've made things easier by
including conditional compilation and reporting, for instance, here's
some very simple reporting:
#Const myDebug = True
Public Sub SimpleLoop
Dim a As Long, b As Long, c As Long
For a = 1 To 4
For b = 1 To 4
For c = 1 To 4
#If myDebug Then
If DebugReport("SimpleLoop", _
"a", a, "b", b, "c", c) Then _
Stop
#End If
Next c
Next b
Next a
End Sub
Private Function DebugReport( _
ParamArray Parms() As Variant) As Boolean
Dim i As Long
On Error GoTo ErrorHandler
Debug.Print vbNewLine & Parms(0), Time
For i = 1 To UBound(Parms) Step 2
Debug.Print Parms(i), Parms(i + 1)
Next i
ExitDebugReport:
Exit Function
ErrorHandler:
Debug.Print "** Error in DebugReport() **"
DebugReport = True
Resume ExitDebugReport
End Function
One could write to a debug worksheet, obviously, or do some
sophisticated analysis, etc.
To run it normally, just change the #Const statement.
.
- References:
- Visual basic Locals Window
- From: Theodore_MH
- Visual basic Locals Window
- Prev by Date: Re: find first row of a list
- Next by Date: Printing blank filler pages
- Previous by thread: Visual basic Locals Window
- Next by thread: Re: Visual basic Locals Window
- Index(es):
Relevant Pages
|