![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | return variable through script in script I am using the following code to run a script within side a script Dim WshShell Set WSHShell =CreateObject("WScript.Shell") WSHShell.Run"""E:\Rc Wintrans\VBscript\1.vbs""" 1.vbs is a small script that opens a single empty excel file. Now in 1.vbs i have created an object of excel in the following way set objExcel=createobject("Excel.Application") this script runs fine and opens an empty excel file. May be alot of people may think that I can achieve the same by making a sub function to open an excel file. With which, I can also return the variable `objExcel` using arguments. But due to some special reason i want to use `script in script` method to open an empty excel file. But i dont know how to return the variable `objexcel` using this method. Can anybody tell me how to return variable through `script in script` |
My System Specs![]() |
| | #2 (permalink) |
| | Re: return variable through script in script "NIDU" <nidu50@xxxxxx> wrote in message news:d0dd359a-8170-47bb-bc85-4f0fc2f47136@xxxxxx Quote: >I am using the following code to run a script within side a script > > Dim WshShell > Set WSHShell =CreateObject("WScript.Shell") > WSHShell.Run"""E:\Rc Wintrans\VBscript\1.vbs""" > > 1.vbs is a small script that opens a single empty excel file. Now in > 1.vbs i have created an object of excel in the following way > > set objExcel=createobject("Excel.Application") > > this script runs fine and opens an empty excel file. May be alot of > people may think that I can achieve the same by making a sub function > to open an excel file. With which, I can also return the variable > `objExcel` using arguments. > But due to some special reason i want to use `script in script` method > to open an empty excel file. But i dont know how to return the > variable `objexcel` using this method. Can anybody tell me how to > return variable through `script in script` system. Any variables that are passed between your script and this new instance are passed via the OS. Since Windows knows nothing about objects, you cannot pass objExcel back to your calling script. By the way, to make your application robust it would be prudent to invoke the external script explicitly with "cscript.exe //nologo 1.vbs" instead of relying on associations that may or may not be present. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Re: delay script return | VB Script | |||
| Script switch parameter as variable | PowerShell | |||
| Script to hide a variable folder | VB Script | |||
| Obtaining Script Exit Return Codes | PowerShell | |||
| Current script special variable | PowerShell | |||