Posts by pope5311

    Re: Can a VB app run VBA code within a workbook?


    Bnix,


    You've got it! Using you're method, (ideally) my VB application could spawn a copy of the currently running excel application (including workbook and add-ins) then hide it, and execute it's VBA functions while I'm debugging the original workbook code.


    Now to figure out how to do that...


    Regards,
    Chris

    Re: Can a VB app run VBA code within a workbook?


    After re-reading my question, it isn't that clear what I'm asking for.


    What I want to be able to do is have a VB application (that I will write) run concurrently with Excel and have the ability for the VB app to run the VBA code that is inside the currently open Excel workbook.


    If that can't be done, then is it possible to have a userform running while stepping through some other VBA code?


    Norie:
    I manually set the break point at some location in the code. When debugging a test, I usually set it on the first line and start from there. As I step through the code I always have to query information from the device. So I perform some bit of code, probe/poke the device to see what happened, rinse/repeat. So what would be great is if I could have a userform that is always running in the foreground that will constantly query the device for me as I step through each line of the test.


    Thanks for the responses,
    Chris

    First some background on why I'm interested in an answer to the question. I'm employed as a Test Engineer for integrated circuits and the (million+ dollar) machines we use, believe it or not, run on Microsoft Excel. This also means our test programs are written in VBA.


    Typically, I set a breakpoint somewhere in the code, run to that point and try to figure out what the device is doing by reading/writing to it's serial port (all in VBA code). So if I have a function that knows how to get the information I'm looking for called GetTheInfo(), then I would open the Immediate window, type the code, and run it. But if what I needed to run was something like a userform, then I couldn't do that because you cannot run some other set of VBA code if the debugger is "paused".


    So now I'm considering using VB to create the userform and have it call the GetTheInfo() that is buried in the workbook's VBA code. Is this possible? Can A VB application run code that is within an open workbook when Excel's VBA debugger is paused on some line of code?


    I guess another question would be, is it possible to run a userform when the VBA debugger is paused?


    Regards,
    Chris