I need to read an Excel file, Sheet, Row, and Column and return the result to MacroScheduler without using DDE (just looks messy to the end user)....I need to send the File, Sheet, Row, Column as variables to a VBScript function.....
I think I am close, but can't quite get it right.
VBSTART
Function XLTest(FileName,xlSheet,xlRow,xlColumn)
Dim xlApp
Dim xlBook
Dim xlPage
Dim TestVal
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(FileName)
Set xlPage = xlBook.Worksheets(1)
xlApp.visible = False
Set TestVal = xlPage.Cells(xlRow, xlColumn).Value
xlApp.Quit
Set xlPage = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Function
VBEND
let>FileName=c:\work\nodupnoblank.xls
let>xlSheet=1
let>xlRow=6500
let>xlColumn=2
Vbe>XLTest("%FileName%","%xlSheet%","%xlRow%","%xlColumn%"),TestVal
mdl>TestVal
Code: Select all