scriptcontrol

How can we programmatically know the syntax error using msscript.ocx?

巧了我就是萌 提交于 2020-03-06 10:45:10
问题 I have implemented msscript.ocx using c# and it works for VBScript. Consider the following VBScript code: For i = 0 To 5 'The following line has missing 'Then'. It should show an error. If i = 2 Exit For End If Next How can we tell if there is an error in line containing If (missing Then ) without running the script? 回答1: You get the error when loading. Set Arg = WScript.Arguments set WshShell = createObject("Wscript.Shell") Set Inp = WScript.Stdin Set Outp = Wscript.Stdout Sub VBSCmd

VBA JavaScript object doesn't support this property or method

荒凉一梦 提交于 2019-12-23 02:25:56
问题 Im trying to get the Text Statistics function from https://github.com/cgiffard/TextStatistics.js/blob/master/index.js Working in Excel I have minified the JavaScript code to shorten the concatenations Function Text_Statistics1(textString As String) Dim code As String code = "function text_stats(teststringtoprocess){(function(e){function t(e){var t=['li','p','h1','h2','h3','h4','h5','h6','dd'];t.forEach(function(t){e=e.replace('</'+t+'>','.')});e=e.replace(/<[^>]+>/g,'').replace(/[,:;()\-]/,'

Getting ScriptControl to work with Excel 2010 x64

时光毁灭记忆、已成空白 提交于 2019-12-17 02:24:13
问题 I am trying to use the solution given to this, however, whenever I try to run the most basic anything, I get an Object not Defined error. I thought this would be my fault (not having installed ScriptControl). However, I tried installing as described in here, to no avail. I am running Windows 7 Professional x64 with Office 2010 64 bit. 回答1: Sadly, scriptcontrol is a 32bit component only and will not run inside a 64bit process. 回答2: You can create ActiveX objects like ScriptControl , which

VBA JavaScript object doesn't support this property or method

故事扮演 提交于 2019-12-06 19:32:32
Im trying to get the Text Statistics function from https://github.com/cgiffard/TextStatistics.js/blob/master/index.js Working in Excel I have minified the JavaScript code to shorten the concatenations Function Text_Statistics1(textString As String) Dim code As String code = "function text_stats(teststringtoprocess){(function(e){function t(e){var t=['li','p','h1','h2','h3','h4','h5','h6','dd'];t.forEach(function(t){e=e.replace('</'+t+'>','.')});e=e.replace(/<[^>]+>/g,'').replace(/[,:;()\-]/,' ').replace(/[\.!?]/,'.').replace(/^\s+/,'').replace(/[ ]*(\n|\r\n|\r)[ ]*/,' ').replace(/([\.])[\. ]+/,

Excel VBA: Parsed JSON Object Loop

这一生的挚爱 提交于 2019-11-26 16:06:20
Per example below...Looping through an object from a parsed JSON string returns an error "Object doesn't support this property or method". Could anyone advise how to make this work? Much appreciated (I spent 6 hours looking for an answer before asking here). Function to parse JSON string into object (this works OK). Function jsonDecode(jsonString As Variant) Set sc = CreateObject("ScriptControl"): sc.Language = "JScript" Set jsonDecode = sc.Eval("(" + jsonString + ")") End Function Looping through the parsed object returns error "Object doesn't support this property or method". Sub

Excel VBA: Parsed JSON Object Loop

浪尽此生 提交于 2019-11-26 04:42:10
问题 Per example below...Looping through an object from a parsed JSON string returns an error \"Object doesn\'t support this property or method\". Could anyone advise how to make this work? Much appreciated (I spent 6 hours looking for an answer before asking here). Function to parse JSON string into object (this works OK). Function jsonDecode(jsonString As Variant) Set sc = CreateObject(\"ScriptControl\"): sc.Language = \"JScript\" Set jsonDecode = sc.Eval(\"(\" + jsonString + \")\") End Function