PDA

View Full Version : Sleeper: Running a VB Function From Excel



Stead
07-02-2005, 02:46 PM
hi, i've been looking for ages on the internet, i've discovered (well told on a forum) how to run a vba macro from a vb application, now i would like to know if its possible to do it the other way round,

currenty i've been using the appactivate command in excel and using the sendkeys to send a letter accross, this results in the application having a case select code on keydown on the form, the problem is this seems random with its reliability, and i've noticed certain worksheet functions won't allow it work (been having a lot of problems with code i've written in the worksheet_before close, which brings me onto my next post...)

I was wondering if anyone knew of away to do this? i have a feeling there isn't without being a pro at these things which i am not! but maybe one day :cloud9:

Ivan F Moala
07-02-2005, 05:34 PM
Hi Stead, which App is automating which ?? ie is your VB App automating Excel OR is Excel automating your VB App.

Stead
07-02-2005, 05:46 PM
well i guess its the VB App automating excel, however i would like them to be able to talk to each other?

I Would like to keep the bulk of the userforms in the exe, as theres things i prefer in vb over vba, such as being able to set index's to objects!

Currently the exe loads up, and then opens excel, loads the spreadsheet, runs a few macro's to set it up, then gives focus to excel and hides in the background.