VoiceGuide IVR Software Main Page
Jump to content

Fail To Open An Excel Workbook

Recommended Posts

Hi,

 

We had an older version of VoiceMail on which our scipts worked just fine. We updated, and now it doesn't anymore. I've tracked one of the problem with an apparent difficulty opening excel workbook. If I try the following script (as a filename.vbs script that I launch by double clicking) :

 

'####################################################################

Dim xlApp, xlBook
Dim filename
Dim bExcelOpened
On Error Resume Next
filename = "C:\LabReves\ScriptAgendaNM\Data\Reve_adult_UID.xls"
'Start Excel
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application") 'Bind to existing instance of Excel
If Err.Number <> 0 Then 'Could not get instance of Excel, so create a new one
Err.Clear
Set xlApp = CreateObject("Excel.Application")
bExcelOpened = False
Else 'Excel was already running
bExcelOpened = True
End If
MsgBox xlApp.Workbooks.Count, vbOKOnly, "Msg"

'####################################################################

... I get as expected a message box with "1" as message. Now, in VoiceGuide, if it run a vba block with the following code :

 

 

 

'####################################################################

Dim xlApp, xlBook, xlSht
Dim filename, value1, value2, value3, value4, j, isValidUID
Dim bExcelOpened
On Error Resume Next
set vg = CreateObject("vgServices.CommandLink")
filename = "C:\LabReves\ScriptAgendaNM\Data\Reve_adult_UID.xls"
'Start Excel
Set xlApp = GetObject(, "Excel.Application") 'Bind to existing instance of Excel
If Err.Number <> 0 Then 'Could not get instance of Excel, so create a new one
Err.Clear
Set xlApp = CreateObject("Excel.Application")
bExcelOpened = False
Else 'Excel was already running
bExcelOpened = True
End If
vg.Admin_TraceLogAdd 0, 0, "Workbook count " & xlApp.Workbooks.Count

 

[...]

'####################################################################

... I get in my log the following line :
150358.875 14 comlg Workbook count 0

 

which indicates me that the workbook failed to open. How could that be?

 

Thanks,

 

Christian

 

 

 

 

 

Share this post


Link to post

Have you tried adding more Admin_TraceLogAdd statements to the VBScript to see where the error occurs?

 

eg:

Set xlApp = GetObject(, "Excel.Application")    'Bind to existing instance of Excel

If Err.Number <> 0 Then    'Could not get instance of Excel, so create a new one
vg.Admin_TraceLogAdd 0, 0, "after get obj err " & Err.Number
Err.Clear
Set xlApp = CreateObject("Excel.Application")
vg.Admin_TraceLogAdd 0, 0, "after CreateObject " & Err.Number
bExcelOpened = False
Else    'Excel was already running
bExcelOpened = True
vg.Admin_TraceLogAdd 0, 0, "after get obj no err"
End If

vg.Admin_TraceLogAdd 0, 0, "Workbook count " & xlApp.Workbooks.Count

Share this post


Link to post

Adding more more Admin_TraceLogAdd statements only leads me to confirm exactly what I observed previously: VoiceGuide refuse to open an Excel workbook. I've try starting from scratch with one of you examples (see http://voiceguide.com/forums/index.php?showtopic=59&hl=%2Bopen+%2Bxls+%2Bsheet) which I modified slightly for testing purpose and ran as

'takes 3 Result Variable inputs,'writes the inputs into an Excel spreadsheet,
'reads the results calculated by Excel in other cells
'returns results back to VoiceGuide.


Dim excel, workbook, sheet
Dim Result1 , Result2 , Result3 , sReturnedRVs


set vg = CreateObject("vgServices.CommandLink")


vg.Admin_TraceLogAdd 0, 0, "Tracing 1"
Set excel = CreateObject("Excel.Application")
vg.Admin_TraceLogAdd 0, 0, "Tracing 2"
Set workbook = excel.Workbooks.Open("C:\SomeSpreadsheet.xls") 
vg.Admin_TraceLogAdd 0, 0, "Tracing 3"
workbook.Sheets("Sheet1").Select


vg.Admin_TraceLogAdd 0, 0, "Tracing 4"
workbook.ActiveSheet.Cells(2, 2).Value = 1 'cell B2
workbook.ActiveSheet.Cells(2, 3).Value = 2 'cell C2
workbook.ActiveSheet.Cells(2, 4).Value = 3 'cell D2


vg.Admin_TraceLogAdd 0, 0, "Tracing 5"
'every time new values are entered Excel recalculates any formulas, 
'allowing us to read data from formula cells at any time...


Result1 = Abs(Cint(workbook.ActiveSheet.Cells(2, 22).Value)) 'cell V2
Result2 = Abs(Cint(workbook.ActiveSheet.Cells(2, 15).Value)) 'cell O2
Result3 = Abs(Cint(workbook.ActiveSheet.Cells(2, 24).Value)) 'cell X2


sReturnedRVs = "[Result1]{" & Result1 & "}[Result2]{" & Result2 & "}[Result3]{" & Result3 & "}"


vg.Admin_TraceLogAdd 0, 0, "Tracing 6"
iRet = WriteResultFile(sReturnedRVs)


vg.Admin_TraceLogAdd 0, 0, "Tracing 7"
'the 3 result varaibles can now be accessed in the script using:
'$RV[Result1] $RV[Result2] $RV[Result3]
msgbox sReturnedRVs


workbook.close False
excel.quit
vg.Admin_TraceLogAdd 0, 0, "Tracing 8"


set excel = Nothing
set workbook = Nothing






function WriteResultFile(strResult)
const ForReading=1, ForWriting=2, ForAppending=8
Dim filename, fso, ts, outdata, outdata2, outdata3 


filename = "C:/test.txt"  ' "VGRUNRESULT_$RV_DEVICEID.TXT"
set fso = CreateObject("Scripting.FileSystemObject")
set ts = fso.OpenTextFile(filename, ForWriting, True)
ts.WriteLine(strResult)
ts.Close
WriteResultFile = 0
end function 
Quote
MultiQuote


I obtained the same results: VoiceGuide is unable to open the workbook. If I look at the vgEngine.txt log file, I see that is fails between check-point 2 and 3.

[...]
180551.705 18   1   1       current objVbsOrExeProcess=
180551.705 18   1   1       RunVBScriptFile [wscript][C:\Program Files\VoiceGuide\temp\vbs_1_1.vbs][] timeout=60 (vbsPath=C:\Program Files\VoiceGuide\temp), start (new Process)
180551.705 18   1   1       objVbsOrExeProcess.Start call
180551.726 19   1   1 ev    PlayEnd 1 486087
180551.726 19   1   1       play  end   id=486087, (current id). Setting .lPlayId=0
180551.726 19   1   1       q scr add   evScriptEvent 8001 EV_PLAY_FINISHED
180551.726  6   1   1       q scr run   evScriptEvent sCode=[EV_PLAY_FINISHED] iActionID=0, crn=0[486087|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180551.726  6   1   1       scriptevent EV_PLAY_FINISHED  486087|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180551.726  6   1   1       LsRunWaitTillFinished EV_PLAY_FINISHED lCode2Str=EV_PLAY_FINISHED
180551.726  6   1   1       path {EV_PLAY_FINISHED} not found
180551.726  6   1   1       LsRunWaitTillFinished play  end   id=486087, iRunWait_MohPlayWasStarted=0. ignoring
180551.731 18   1   1       RunVBScriptFile just started. Handle=33956, Id=7300, StartTime=2013-09-30 18:05:51, HasExited=False
180551.732 18   1   1       VBScript started [C:\Program Files\VoiceGuide\temp\vbs_1_1.vbs], ProcessHandle=[33956], VbsOrExeProcess.WorkingSet=[114688]
180551.732 18   1   1       RunModule_Script_AfterScriptStarted start
180551.732 18   1   1       Run Script waiting. iRunWait=1 (process:33956)
180551.732 18   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180551.732 18   1   1       moh file not specified
180552.579  4   1   1 timer EV_TIMEOUT_CHECKONSTATE
180552.579  4   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180552.579  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180552.579  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180552.579  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180552.579  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180552.579  6   1   1       .ExitTime returned error.
180552.579  6   1   1       LsRunWaitTillFinished: process still running
180552.579  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180553.179 29         rem   vgRemotingCommandLink constructor start, parmameterless
180553.179 29               remoting link constructor activated: vgServices_CommandLink
[color=#ff0000][b]180553.182 29         comlg Tracing 1[/b][/color]
180553.624 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180553.624 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180553.624  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180553.624  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180553.624  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180553.624  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180553.624  6   1   1       .ExitTime returned error.
180553.624  6   1   1       LsRunWaitTillFinished: process still running
180553.624  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
[color=#ff0000][b]180553.935 29         comlg Tracing 2[/b][/color]
180554.669  4   1   1 timer EV_TIMEOUT_CHECKONSTATE
180554.669  4   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180554.669  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180554.669  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180554.669  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180554.669  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180554.669  6   1   1       .ExitTime returned error.
180554.669  6   1   1       LsRunWaitTillFinished: process still running
180554.669  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180555.699 16   1   1 timer EV_TIMEOUT_CHECKONSTATE
180555.699 16   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180555.699  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180555.699  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180555.699  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180555.699  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180555.700  6   1   1       .ExitTime returned error.
180555.700  6   1   1       LsRunWaitTillFinished: process still running
180555.700  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180556.744 16   1   1 timer EV_TIMEOUT_CHECKONSTATE
180556.744 16   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180556.744  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180556.744  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180556.744  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180556.744  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180556.744  6   1   1       .ExitTime returned error.
180556.744  6   1   1       LsRunWaitTillFinished: process still running
180556.744  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180557.789 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180557.789 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180557.789  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180557.789  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180557.789  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180557.789  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180557.789  6   1   1       .ExitTime returned error.
180557.789  6   1   1       LsRunWaitTillFinished: process still running
180557.789  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180558.818 16   1   1 timer EV_TIMEOUT_CHECKONSTATE
180558.818 16   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180558.818  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180558.818  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180558.818  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180558.818  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180558.818  6   1   1       .ExitTime returned error.
180558.818  6   1   1       LsRunWaitTillFinished: process still running
180558.818  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180559.863 16   1   1 timer EV_TIMEOUT_CHECKONSTATE
180559.863 16   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180559.863  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180559.863  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180559.863  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180559.863  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180559.863  6   1   1       .ExitTime returned error.
180559.863  6   1   1       LsRunWaitTillFinished: process still running
180559.863  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180600.893 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180600.893 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180600.893  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180600.893  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180600.893  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180600.893  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180600.894  6   1   1       .ExitTime returned error.
180600.894  6   1   1       LsRunWaitTillFinished: process still running
180600.894  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180601.938 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180601.938 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180601.938  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180601.938  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180601.938  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180601.938  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180601.938  6   1   1       .ExitTime returned error.
180601.938  6   1   1       LsRunWaitTillFinished: process still running
180601.938  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180602.983 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180602.983 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180602.983  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180602.983  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180602.983  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180602.983  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180602.983  6   1   1       .ExitTime returned error.
180602.983  6   1   1       LsRunWaitTillFinished: process still running
180602.983  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180604.013  4   1   1 timer EV_TIMEOUT_CHECKONSTATE
180604.013  4   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180604.013  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180604.013  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180604.013  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180604.013  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180604.013  6   1   1       .ExitTime returned error.
180604.013  6   1   1       LsRunWaitTillFinished: process still running
180604.013  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180605.058  4   1   1 timer EV_TIMEOUT_CHECKONSTATE
180605.058  4   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180605.058  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180605.058  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180605.058  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180605.058  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180605.058  6   1   1       .ExitTime returned error.
180605.058  6   1   1       LsRunWaitTillFinished: process still running
180605.058  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180606.103 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180606.103 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180606.103  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180606.103  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180606.103  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180606.103  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180606.104  6   1   1       .ExitTime returned error.
180606.104  6   1   1       LsRunWaitTillFinished: process still running
180606.104  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180607.134 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180607.134 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180607.134  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180607.134  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180607.134  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180607.134  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180607.134  6   1   1       .ExitTime returned error.
180607.134  6   1   1       LsRunWaitTillFinished: process still running
180607.134  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180608.178 16   1   1 timer EV_TIMEOUT_CHECKONSTATE
180608.178 16   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180608.178  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180608.178  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180608.178  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180608.178  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180608.178  6   1   1       .ExitTime returned error.
180608.178  6   1   1       LsRunWaitTillFinished: process still running
180608.178  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180609.223 16   1   1 timer EV_TIMEOUT_CHECKONSTATE
180609.223 16   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180609.223  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180609.223  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180609.223  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180609.223  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180609.223  6   1   1       .ExitTime returned error.
180609.223  6   1   1       LsRunWaitTillFinished: process still running
180609.223  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180610.253 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180610.253 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180610.253  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180610.253  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180610.253  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180610.253  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180610.253  6   1   1       .ExitTime returned error.
180610.253  6   1   1       LsRunWaitTillFinished: process still running
180610.253  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180611.298 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180611.298 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180611.298  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180611.298  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180611.298  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180611.298  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180611.299  6   1   1       .ExitTime returned error.
180611.299  6   1   1       LsRunWaitTillFinished: process still running
180611.299  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180612.343  4   1   1 timer EV_TIMEOUT_CHECKONSTATE
180612.343  4   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180612.343  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180612.343  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180612.343  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180612.343  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180612.343  6   1   1       .ExitTime returned error.
180612.343  6   1   1       LsRunWaitTillFinished: process still running
180612.343  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180613.373 16   1   1 timer EV_TIMEOUT_CHECKONSTATE
180613.373 16   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180613.373  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180613.373  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180613.373  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180613.373  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180613.373  6   1   1       .ExitTime returned error.
180613.373  6   1   1       LsRunWaitTillFinished: process still running
180613.373  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180614.417 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180614.417 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180614.417  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180614.417  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180614.417  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180614.417  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180614.417  6   1   1       .ExitTime returned error.
180614.417  6   1   1       LsRunWaitTillFinished: process still running
180614.417  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180615.463 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180615.463 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180615.463  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180615.463  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180615.463  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180615.463  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180615.463  6   1   1       .ExitTime returned error.
180615.463  6   1   1       LsRunWaitTillFinished: process still running
180615.463  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE
180616.493 18   1   1 timer EV_TIMEOUT_CHECKONSTATE
180616.493 18   1   1       q scr add   evScriptEvent 9007 EV_TIMEOUT_CHECKONSTATE
180616.493  6   1   1       q scr run   evScriptEvent sCode=[EV_TIMEOUT_CHECKONSTATE] iActionID=0, crn=0[0|0|0|0|0][|||||] 00:00:00 max:2|00:00:00.0070000
180616.493  6   1   1       scriptevent EV_TIMEOUT_CHECKONSTATE  0|0|0  || LineState=LS_RUN_WAITTILLFINISHED
180616.493  6   1   1       LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE lCode2Str=EV_TIMEOUT_CHECKONSTATE
180616.493  6   1   1       Process.HasExited is false (awaiting process end or COM function call) handle=33956, id=7300, StartTime=2013-09-30 18:05:51
180616.494  6   1   1       .ExitTime returned error.
180616.494  6   1   1       LsRunWaitTillFinished: process still running
180616.494  6   1   1 t     timer set   1 sec : EV_TIMEOUT_CHECKONSTATE


What can cause Excel such failure? I've try changing the workbook in case there was a problem with the file, try moving it to "C:\Program Files\VoiceGuide\temp" in case there was some access restriction issue on "C:\", try making a VoiceGuide script from scratch in case there was some problem with the script. It cannot be that Excel COMs or VBA are not working or some other basic issue (e.g. misspelling in the file name) since the same code (except for the reference to VoiceGuide objects, see the code below for the exact script) work like a charm launching it as a standalone VBA script.

 

So, what can cause this problem? Thanks.

 

 

Code of the standalone version of the VBA script.

'takes 3 Result Variable inputs,
'writes the inputs into an Excel spreadsheet,
'reads the results calculated by Excel in other cells
'returns results back to VoiceGuide.


Dim excel, workbook, sheet
Dim Result1 , Result2 , Result3 , sReturnedRVs


Set excel = CreateObject("Excel.Application")
Set workbook = excel.Workbooks.Open("C:\SomeSpreadsheet.xls") 
workbook.Sheets("Sheet1").Select


workbook.ActiveSheet.Cells(2, 2).Value = 1 'cell B2
workbook.ActiveSheet.Cells(2, 3).Value = 2 'cell C2
workbook.ActiveSheet.Cells(2, 4).Value = 3 'cell D2


'every time new values are entered Excel recalculates any formulas, 
'allowing us to read data from formula cells at any time...


Result1 = Abs(Cint(workbook.ActiveSheet.Cells(2, 22).Value)) 'cell V2
Result2 = Abs(Cint(workbook.ActiveSheet.Cells(2, 15).Value)) 'cell O2
Result3 = Abs(Cint(workbook.ActiveSheet.Cells(2, 24).Value)) 'cell X2


sReturnedRVs = "[Result1]{" & Result1 & "}[Result2]{" & Result2 & "}[Result3]{" & Result3 & "}"


iRet = WriteResultFile(sReturnedRVs)


'the 3 result varaibles can now be accessed in the script using:
'$RV[Result1] $RV[Result2] $RV[Result3]
msgbox sReturnedRVs


workbook.close False
excel.quit


set excel = Nothing
set workbook = Nothing






function WriteResultFile(strResult)
const ForReading=1, ForWriting=2, ForAppending=8
Dim filename, fso, ts, outdata, outdata2, outdata3 


filename = "C:/test.txt"  ' "VGRUNRESULT_$RV_DEVICEID.TXT"
set fso = CreateObject("Scripting.FileSystemObject")
set ts = fso.OpenTextFile(filename, ForWriting, True)
ts.WriteLine(strResult)
ts.Close
WriteResultFile = 0
end function 

Share this post


Link to post

VoiceGuide v7 runs as a Windows Service. Which is probably why you are seeing different results when .VBS file is started by user vs started by VoiceGuide.

 

Please try this:

 

in Windows Control Panel -> Administrative Tools -> Services

 

find VoiceGuide IVR,

 

Right-click on "VoiceGuide IVR" and select "Properties"

 

On "Log On" tab tick "Allow service to interact with desktop".

 

Restart VoiceGuide service.

 

You can also experiment running VoiceGuide IVR service under different accounts.

Share this post


Link to post

This does not fix the issue. Checking "Allow service to interact with desktop" made popup an error message when the script is ran by the VoiceGuide service saying :

Script: C:\Program Files\VoiceGuide\temp\vbs_1_1.vbs
Line  : 15
char  : 1
Error : MicrosoftOffice Excelcannot access the file "C\ComeSpreadSheet.xls", There are several possible reasons:

- The file name of path does not exist.
- The file is being used by another program.
- The workbook you are trying to save has the same nam as a currently open workbook.
Code: 800A03EC
Source: Microsoft Office Excel

None of these reasons appears valid since the script works just fine outside VoiceGuide.

 

As for running the VoiceGuide service under different accounts, I ran it with a full privileges administrative account and with the same user account that I run the standalone VBS script, with every time the same outcome.

Share this post


Link to post

Google brings up some links on subject on using MS Excel COM automation objects from a Windows Service:

 

http://stackoverflow.com/questions/14037412/cannot-access-excel-file

 

http://support.microsoft.com/kb/257757

 

http://stackoverflow.com/questions/7106381/microsoft-office-excel-cannot-access-the-file-c-inetpub-wwwroot-timesheet-app

 

 

Also, C:\ could be a protected/restricted folder. Suggest using .xls form some other folder eg. C:\mytest\

Share this post


Link to post

The folder "C:\Windows\system32\config\systemprofile\desktop" needed to be created to fix the issue. Thanks.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×