tags:

views:

40

answers:

1

I ve been given a VBA spreadsheet which calls functions that are written in VB6 and 'COM' exposed.

Can anyone indicate:

  1. How I can find the location of the dll / binary that VBA actually calls in the COMP calls?
  2. How I can attach a debugger to VB and get hit when the function os called.

I come from a C sharp background so would really appreciate help here

EDIT: I have the source code and have found the references from Excel - How do I attach a VB6 debugger to Excel and get hit on a breakpoint?

+2  A: 

To find out what the library file is, you open the VBA IDE (usually by pressing Alt+F11 in the hosting application) and go to Project->References.
If there's nothing interesting, you want to search the VBA code for calls to CreateObject, which will give you the ProgIDs of the COM objects, which you then can find in the registry.

Lacking the source code, you can debug the VB6 library as you would debug any random application -- by attaching the VS debugger to it.

GSerg
I have the source code - What I still dont understand is how I can attach from VB6 to a running process.
ChloeRadshaw
@Chloe Then load up the source code in VB6, go to project properties, `Debug` tab, make sure it says "Wait for components to be created", set some breakpoints in the code and press F5 to run the project (the IDE will start waiting for objects being created). Then try using the objects from your app.
GSerg
@GSerg: Remember that this is being called from VBA. How will VB know when its objects are created. I have several copies of the binaries referenced from VBA. Do I go to VBA project properties and add reference (If so to which binary exactly) to allow me to attach to process?
ChloeRadshaw