Does anyone know how I can call a subroutine from VB instead of from VBA. Right now what I can do is run the vb exe file from the command line which normally opens up the exe's form from which I can run various functions by clicking button from said form etc. But on top of that I also need to be able to do something like a (vl-vbarun mysubroutineNameHere) from the command prompt to be able to make calls to the certain specific VB routines. Right now the only option I can think of is create a .dll and reference it from vba which is no problem -- but what I want is to be able to do it straight from VB instead so that I do not have to regsvr32 on all machines that will try to run my program. Thanks for all the kind help you can give on this matter. Matt
You could pass command line arguments to your VB app, check for them in Sub Main(), and call your subroutines from there. BTW, you don't need regsvr32 - you can call the DllRegisterServer function exported by any ActiveX dll.
If you don't know the name of the dll until run-time then you'll have to duplicate the functionality of regsvr32: LoadLibrary to load the dll, GetProcAddress to get a pointer to the function, then call the function pointer. I recommend Mathew Curland's Advanced Visual Basic 6 for detailed instructions.
Hi, The easiest solution to this type of problem is to create an install for your program with a product like Inno Setup which enables you to register all the DLLs with the installation. -- Regards, Laurie Comerford www.cadapps.com.au
Thank you, this looks like one possible solution. I can see a potential problem though -- and the reason is that I am looking at making the user only have to call the program once -- like on startup of AutoCAD. The program will automatically open up. Then it will be like a toolbar that stays up there -- so the solution you mentioned can work but it does not look like its going to be in that kind of scenario where I do not have to go doing Shell or ShellExecute to the .exe file which also erases all the values of global variables everytime. Matt
I think I can work around the potential problem I mentioned -- thank you for the brilliant concept you have shared. Matt