Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 19th, 2004, 04:01 AM
Authorized User
 
Join Date: Jan 2004
Location: , , .
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

//##
Reply With Quote
  #2 (permalink)  
Old July 19th, 2004, 05:45 AM
Registered User
 
Join Date: Jul 2004
Location: , , .
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

Reply With Quote
  #3 (permalink)  
Old July 19th, 2004, 05:59 AM
Authorized User
 
Join Date: Jan 2004
Location: , , .
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?

Reply With Quote
  #4 (permalink)  
Old July 19th, 2004, 09:51 AM
Registered User
 
Join Date: Jul 2004
Location: , , .
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:
Reply With Quote
  #5 (permalink)  
Old July 19th, 2004, 01:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.