Tuesday, January 06, 2009     | Register
TradersStudio Forums
Subject: Controlling TradersStudio from Excel

You are not authorized to post a reply.   
Author Messages
tbengtsson
Posts:10

08-25-2008 2:06 PM Alert 

Is it possible (I would think that it is given the claim of having a complete OLE interface with Excel) to run TradersStudio macros from Excel?

I want to create a Excel interface where I can feed variables to TradersStudio macros from Excel. The logic of the VBA code would be something like:

'Start of code

Misc code to set the appropriate values for variables to use in creating TradersStudio sessions and running the sessions

Activate connection to TradersStudio

In TradersStudio, RunMacroCreateSession (MomSeries, ChildSeries,,,,) where MomSeries and other variables are declared in the Excel code. Obviously I would first code the RunMacroCreateSession macro in TradersStudio to do what I want it to do with the variables provided.

RunMacroSessionAndCreateTxtFile(Param1, Param2), which would run the session just created and where Param1 and Param2 would come from Excel variables. The TradersStudio macro would create a txt file with the results from the session, and the VBA code could then open the txt file for further processing. RunMacroSessionAndCreateTxtFile would be a macro already I created in TradersStudio.

'End of code

I was wondering if anyone had any examples of how to reference TradersStudio in the VBA code to get this to work, similar to how you can control Word or Access from within Excel using VBA code. I am reasonably confident I can get the VBA code to work as long as I know how to establish the TradersStudio connection.

I appreciate any help on this.

Best regards,

tbengtsson

murray
Posts:435

08-25-2008 4:41 PM Alert 
You can control Excel from TradersStudio but I without some extra-coding in VB 6.0 or C++ I don't think you can do it the other way around.
murray
Posts:435

08-25-2008 4:41 PM Alert 
You can control Excel from TradersStudio but I without some extra-coding in VB 6.0 or C++ I don't think you can do it the other way around.
murray
Posts:435

08-25-2008 4:41 PM Alert 
You can control Excel from TradersStudio but I without some extra-coding in VB 6.0 or C++ I don't think you can do it the other way around.
murray
Posts:435

08-25-2008 4:41 PM Alert 
You can control Excel from TradersStudio but I without some extra-coding in VB 6.0 or C++ I don't think you can do it the other way around.
tbengtsson
Posts:10

08-27-2008 3:31 PM Alert 

I am definetely expecting to write more code to accomplish this. What I am explicitly looking for is instructions on how to initialize TradersStudio from an outside application such as Excel. To use Excel as an example, in order to access Excel through VB code from another application e.g. Word I would write

Dim objApp as Object

Set objApp = CreateObject("Excel.Application")

It seems to me, since TradersStudio's objects are visible in VB if I reference the DLLs that I should be able to do the same with TradersStudio.

I tried the following

Dim objApp as Object

Set objApp = CreateObject("TSProcessor.Processor")

However, that gives me a "Permission denied" error. Since there is no documentation on this, I don't know how to continue. I can't think of a reason why TradersStudio's developers would NOT want this to be possible to do since it would greatly enhance the flexibility and usefulness of the software. I can refer you to competing products that explicitly document how to accomplish this with their software. I believe it has to do with how the software is registered in the Windows Registry but how to fix that is beyond my current knowledge.

As usual (or actually much more than usual), I would greatly appreciate instructions on how to get this to work.

If I should address in another way (e.e direct e-mail to tech support) please let me know.

Best regards,

tbengtsson

 

 

murray
Posts:435

08-27-2008 4:45 PM Alert 

The problem is you need to get the handles for the project objects from TradersStudio.

The only possible way would be to use two way communications. create a COM DLL which Excel can communicate with and has events enabled and is also a normal addin to TradersStudio. Look at the VB addins which come with the product for an idea of how to make this work.

The mechanism was not designed like that because I did not see people running it form excel, I saw being able to control Excel was enough.

tbengtsson
Posts:10

08-27-2008 4:57 PM Alert 
Thanks for the explanation. Now I have something to work with.

Regards,
tbengtsson
You are not authorized to post a reply.
Forums > TradersStudio 2.x > TradersStudio Basic > Controlling TradersStudio from Excel



ActiveForums 3.6
TradersStudio® Copyright 2004-2009 All Rights Reserved   |  Privacy Statement  |  Terms Of Use