Visual basic Locals Window

T

Theodore_MH

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?

Many thanks.
 
J

JE McGimpsey

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top