Home

"VBScript"

%3CLINGO-SUB%20id%3D%22lingo-sub-544717%22%20slang%3D%22es-ES%22%3EVBScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-544717%22%20slang%3D%22es-ES%22%3E%3CP%3EGood%20night%3C%2FP%3E%3CP%3EI'm%20trying%20to%20program%20a%20macro%20with%20the%20following%20code%3C%2FP%3E%3CP%3ESub%20process%20()%3CBR%20%2F%3EDim%20equation%20As%20String%3CBR%20%2F%3EDim%20sustecuacion%20As%20String%3CBR%20%2F%3EDim%20Result%20As%20Double%3CBR%20%2F%3EDim%20formula%20as%20ScriptControl%3CBR%20%2F%3ESet%20formula%20%3D%20New%20ScriptControl%3CBR%20%2F%3Eformula.%20Language%20%3D%20%22VBScript%22%3C%2FP%3E%3CP%3EDim%20A%2C%20B%2C%20t%20As%20Double%3CBR%20%2F%3Ea%20%3D%20Calculator.%20txt_a.%20value%3CBR%20%2F%3Eb%20%3D%20Calculator.%20Txt_b.%20value%3CBR%20%2F%3Eequation%20%3D%20Calculator.%20txt_ecuacion.%20Value%3CBR%20%2F%3ESustecuacion%20%3D%20WorksheetFunction.%20Substitute%20(Equation%2C%20%22T%22%2C%20CStr%20(a))%3CBR%20%2F%3Eresult%20%3D%20formula.%20Eval%20(sustecuacion)%3CBR%20%2F%3EDebug.%20Print%20sustecuacion%20%26amp%3B%20%22%3D%22%20%26amp%3B%20result%3CBR%20%2F%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20in%20%3CSPAN%3Eformula.%20Language%20%3D%20%22VBScript%22%20I%20get%20an%20error%20already%20try%20activating%20the%20references%20Microsoft%20VBScript%201.0%20and%20VBScript%205.5%20but%20none%20serves%20and%20TB%20is%20enabled%20Microsoft%20Script%20Control%201.0%2C%20I%20need%20this%20code%20to%20iterate%20an%20equation.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EPlease%20help%20me%20thank%20you%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-544717%22%20slang%3D%22es-ES%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Omar312014
Occasional Visitor

buenas noches

estoy intentado programar una macros con el siguiente código

Sub procesar()
Dim ecuacion As String
Dim sustecuacion As String
Dim resultado As Double
Dim formula As ScriptControl
Set formula = New ScriptControl
formula.Language = "VBScript"

Dim a, b, t As Double
a = calculadora.txt_a.Value
b = calculadora.txt_b.Value
ecuacion = calculadora.txt_ecuacion.Value
sustecuacion = WorksheetFunction.Substitute(ecuacion, "t", CStr(a))
resultado = formula.Eval(sustecuacion)
Debug.Print sustecuacion & "=" & resultado
End Sub

 

pero en formula.Language = "VBScript" me sale un error ya intente activando las referencias Microsoft VBScript 1.0 y VBScript 5.5 pero ninguna sirve y tb esta activado Microsoft script control 1.0, necesito este código para poder iterar una ecuación.

porfavor ayúdenme gracias

Related Conversations
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
2 Replies
*Updated 9/3* Syncing in Microsoft Edge Preview Channels
Elliot Kirk in Articles on
202 Replies
Early preview of Microsoft Edge group policies
Sean Lyndersay in Discussions on
65 Replies