[solved] Sharing data between Excel VB and Qt application



  • Hello
    I've I have quite extensive excel document that gathers a lot of data using VB macros. I would now like to export this data directly to an external Qt application without the need to save and open in between, but a direct data exchange instead. Does anyone know if this is possible?
    Best regards
    Richard

    ps. hopefully not completely off topic



  • I don't think transferring data is possible like that. From the top of my head, I think you have to save temporarily, and then send an execution command with a specific command line to your Qt program, telling it where the file was saved. And so you could get your connection.



  • I guess you mean VBA?

    Anyway, I think the easiest way to work would be to write out the data to a (text) file, and then call your application from VBA to trigger it to read in that file. It is possible to make your Qt application a COM/ActiveX provider application as well, allowing you to provide direct access to its data structures from VBA, but I would recommend against that.

    How you do that on the VBA side of things is off topic here though.



  • Yes, I meant VBA. And thank you. As the actual data amount to be transferred is small, I'll go for copy/paste approach, having the VBA create a "summary" for me. Pitty, there isn't a way to automate this, as it will be used really often...

    • Richard


  • Of course you can automate it. You can even use the clipboard automatically, if you prefer. I think VBA supports putting contents on the clipboard, and Qt has [[doc:QClipboard]] that will allow you allow you to read from it again. All you need to do from VBA is execute your application (or perhaps a small, specialized helper app) so that it will read the clipboard and do whatever you want to do with its contents.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.