I've a Vbscript for merging excel sheet into a single workbook. I would like to know whether we could execute vbscript (.vbs) file in unix system. If yes, please help me with the procedures. Thanks in advance.
Not sure about Unices, but on GNU/Linux it is possible to run VBScript using Wine, but VBScript support is limited.
On Debian/Ubuntu you can install as follows:
$ sudo apt-get install wine
...
$
To run from command line:
$ wine cscript some-script.vbs
or
$ wine wscript some-script.vbs
For example I can run following script using Wine 1.7.19 from Ubuntu Wine PPA:
' test.vbs
'WScript.Echo "Echo test" ' doesn't work
'MsgBox "Message box!" ' look like doesn't work either
' Write to file - works
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("out.txt", True)
objFile.Write "Output to file test" & vbCrLf
objFile.Close
run:
$ wine cscript test.vbs
fixme:vbscript:VBScript_SetScriptState unimplemented SCRIPTSTATE_INITIALIZED
fixme:scrrun:textstream_Close (0x13e208): stub
$ cat out.txt
Output to file test
$
WScript.Echo "test"
–
Km You can install vbsedit on your windows box, use it to create and executable from the vbscript. You can then use Wine/PlayonLinux to run the executable code.
The simple answer to your question is Yes we can run VBScript on UNIX. But you will not be able to run excel on it. Although even if you get Excel to run using WINE I dont know how it would link the COM objects in the Excel to VBScript .
One possible altenative could be to install OpenOffice on the *NIX box and then configure OpenOffice to save and create Excel Docs(but I am not very sure about this)
Use wine start /path/to/your/script/script.vbs
.
© 2022 - 2024 — McMap. All rights reserved.