Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a string back from a SHELL Call

Status
Not open for further replies.

ArferMo

Programmer
Mar 11, 2005
8
0
0
GB
I am using Extra V6.7 and need to populate a string variable within an Extra Macro with some text that is unable to be read directly by the Extra Macro. I have written a VB6 .EXE programme that will read the required text from the remote location when supplied with the three input variables. The problem is that I cant suss out how to get the required text back into the extra macro.

The dirty work around that I am using at the moment is for the VB6 programme to read the text then save it to a text file on the local PC, the Extra Macro then reads this text file after the VB6 programme has run and loads it into the required string variable.

There must be a way to do this but it is not something that I have done before. I'm fine with dooing it the other way around... driving Extra from Word, Excel, Access or VB but in this case I need the Extra Macro to do the driving and get the answer.

Dim ToBeSent As String
Dim MyShell As Single

'I need to pass three strings the the .EXE programme.
ToBeSent = "MySrtVar1,MyStrVar2,MyStrVar3"
'Add the location of the programme.
ToBeSent = "C:\MyProggy.exe " + ToBeSent + ","
MyShell = Shell(ToBeSent,1)
Msgbox MyShell 'This will now contain a number.

'Then later I read the .txt file and load the text into a variable for processing.
Open "C:\MyTextFile.txt" For Input As #FileNumber

Anyone got any pointers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top