Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Unassigned: On Error Resume Next in VBScript [97]

$
0
0
I have previously used the MSScriptControl COM object and have switched to ClearScript. The problem I am seeing, currently, is that whatever implementation ClearScript uses doesn't honor the On Error Resume Next and simply crashes out, throwing an error.

Is there a way to have ClearScript honor this error handling or something I can do to prevent it from crashing?
Comments: We've tried to replicate your setup but still cannot reproduce the problem. Here's our C# and VBScript test code: ``` C# var xlapp = new Microsoft.Office.Interop.Excel.Application(); engine.AddHostObject("api", HostItemFlags.GlobalMembers, new { ExcelApplication = xlapp }); engine.Execute(@" Function GetSheetName(workbook, sheet) On Error Resume Next GetSheetName = ExcelApplication.Workbooks(workbook).Sheets(sheet).Name End Function "); engine.Execute(@" ExcelApplication.Workbooks.Add(""hello.xlsx"") : Rem valid file path name1 = GetSheetName(1, 1) : Rem succeeds; name1 is 'Sheet1' name2 = GetSheetName(2, 1) : Rem fails but does NOT crash; name2 is empty "); ``` Is there something you're doing differently? What exception are you seeing in your application code?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images