Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2004, 04:01 AM
Authorized User
 
Join Date: Jan 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I debug an ActiveX DLL referenced by Excel?

Help!

I am writing a DLL with VB6 that is used by an Excel spreadsheet. When I run the spreadsheet, it passes values from the sheet to functions in the DLL. The DLL stores hundreds of values in arrays.

What is the best way of seeing those values? Currently I am writing additional "debug" functions to write the values back to the spreadsheet, but this is dreadfully time-consuming.

Is there a debugger that will enable me to interrogate variable arrays etc. in the DLL *during* the running of the VBA in the spreadsheet?

Your guidance is appreciated.

Thanks.

James

//##
 
Old July 19th, 2004, 05:45 AM
Registered User
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

James,
Generally the best way to expose data from an encapsulated array is via an Item Property

Option Explicit
Private m_strItem As String
Private m_Items() As String


Public Property Get Item(lngIndex) As String

    If lngIndex >= 0 And lngIndex >= UBound(m_Items) Then
        Item = m_Items(lngIndex)
    End If

End Property

Public Property Let Item(lngIndex, ByVal strItem As String)

    If lngIndex >= 0 And lngIndex >= UBound(m_Items) Then
        m_Items(lngIndex) = strItem
    Else
        ' Need check for Redimming the Array etc

    End If

End Property

 
Old July 19th, 2004, 05:59 AM
Authorized User
 
Join Date: Jan 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, but that is in effect what I'm doing, and it's not appropriate because of the sheer number of arrays to look at.

I need a debugging environment.

I know that you can debug a DLL if you are referencing it in a VB exe (you use the test procedures for an out-of-process component). However, I can't see how to debug my DLL while referencing it from an Excel spreadsheet (which is what I need to do).

Please can anyone help?

 
Old July 19th, 2004, 09:51 AM
Registered User
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

James,
You can use the VB IDE i.e. Start VB, open the dll's project and run the dll. Then open Excel and run your routine. VB should then re-direct calls from the dll to the running vbp, where you can step through the code and print to the Debug window. Nb Your dll vbp must be running before you open the Excel Workbook.
a:
 
Old July 19th, 2004, 01:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello James,
start VB and load the dll. If you did not make it already, build the project so the dll gets registered. Got to Project/Properties and open the Debug tab. Check the "Start Program" button and enter fullPath\excel.exe (or select it via the ... button.
Set any breakpoints you want.
Now run Excel and keep its window small so you can still see VB and wait for the first breakpoint.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Advantages /Disadvantages of ActiveX DLL & ActiveX priyank Beginning VB 6 6 February 19th, 2007 11:34 AM
Debug COM DLL from VS 2005 kjullion BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 2 February 26th, 2006 10:28 AM
remove Excel Toolbars using an ActiveX DLL maxpotters Pro VB 6 1 September 11th, 2005 08:05 AM
Removing Excel toolbars from within ActiveX DLL maxpotters Excel VBA 1 September 11th, 2005 08:05 AM
Referencing an ActiveX DLL from Excel james gold Excel VBA 1 September 10th, 2003 10:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.