msscriptcontrol

64 bit Excel VBA to call a JavaScript function

Deadly 提交于 2021-02-11 18:16:43
问题 I need to use a VBA ScriptControl object to call a JavaScript function , but it gave me a "Class Not Registered" error. I have added Microsoft Script Control 1.0 from Tools->References I need to call JavaScript to get a JSON object from this Rest API to calculate values in an Excel Macro. This post told me that ScriptControl is for use in 32 bit only. I am using 64 bit Excel. I also tried using the method mentioned in this link but it didn't work since VBA doesn't recognise the ActiveXObject

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

What can't I use when UseSafeSubset is true?

人盡茶涼 提交于 2019-12-25 04:33:25
问题 When I use an MSScriptControl in VB6, and set UseSafeSubset = True , what kind of things can't I do? I mean, what Controls can't I use? Or maybe some core Objects can't be instantiated or used? Maybe I can't CRUD files? I need a definitive list, please. This thread tells of a special flag in the registry that sets which controls are blocked when UseSafeSubset = True , but it doesn't elaborate on it. It says it should be easy to search, but two days of Googling found nothing. 回答1: VBScript had

C# run VBScript with MSScriptControl AddObject with string failed

萝らか妹 提交于 2019-12-24 14:53:15
问题 This is my C# program: class Program { static void Main(string[] args) { CallVbsFunction(1); //Work CallVbsFunction(1.2); //Work CallVbsFunction('a'); //Work CallVbsFunction("a"); //!!Exception see bellow } private static void CallVbsFunction(object p) { var sc = new MSScriptControl.ScriptControl(); sc.Language = "VBScript"; sc.AllowUI = true; try { sc.AddCode(System.IO.File.ReadAllText("script.vbs")); sc.AddObject("myguid", p, false); var parameters = new object[] { "a" }; sc.Run("test", ref

CodeFluent vs Interop.MSScriptControl.dll

本小妞迷上赌 提交于 2019-12-02 02:46:48
问题 We had a 32 bits service that we are trying to migrate to 64 bits. We were using Interop.MSScriptControl.dll to evaluate vb script written by users. Since there is no 64 bits version of the MSScriptControl . I created a process that was called inside the service. Each time that we need to evaluate users scripts, we call the process. After trying this solution, I found it really slow. I just discovered the CodeFluentRuntimeClient library that can evaluate vb script as well as JavaScript.