Calling a vbscript from a jscript and returning a value
Hi everyone,
I am trying to simplify a tedious task : everyday I have to fill an InDesign document with 48 different numbers that go into 48 text frames. I would like to write a script to get those numbers (temperatures that I receive in an excel file) automatically and write them into the corresponding text frames.
So basically I'm using jscript to set up a document. Then I want it to call a vbscript (since only vbscript can retrieve an excel cell value) and have it send the value back to the jscript in a variable.
So far, I've managed to adapt a .vbs script that retrieves the number from the cell and displays it in a box :
Option Explicit
Dim objApp, objWbs, objWorkbook, objSheet
Set objApp = CreateObject("Excel.Application")
Set objWbs = objApp.WorkBooks
objApp.Visible = False
Set objWorkbook = objWbs.Open("C:\Temperature")
Set objSheet = objWorkbook.Sheets("Sheet1")
MsgBox objSheet.Range("C5").Value
objWorkbook.Close False
objWbs.Close
objApp.Quit
Set objSheet = Nothing
Set objWorkbook = Nothing
Set objWbs = Nothing
Set objApp = Nothing
But it does only that. I still have trouble with :
1) the doScript command : how should I call the vbscript from the jscript?
2) writing the retrieved value (or array) into a variable in the vbscript
The rest is easier : in the jscript, write the array into the corresponding text frames.
Hope someone can help me. Thanks very much
Maphio M.
