0

Having problems with this and couldn't find a solution online that was more specific to what I am having trouble with.

I have an expression like this

pictureFolderFullPath = "C:\Work"

'Create Script Control Obj
Dim sc As ScriptControl
Set sc = CreateObject("ScriptControl")
sc.Language = "VBScript"

Dim content As String
content = sc.Eval("pictureFolderFullPath & "\3.jpg"")

Then, the content becomes only "\3.jpg", instead of having the full path of the picture

5
  • 1
    You have to add picturefolderpath to the script's namespace. sc.AddObject "frmSDI", frmSDI, True Commented Jun 23, 2014 at 18:46
  • Okay. I've tried adding the line sc.AddObject("pictureFolderFullPath", pictureFolderFullPath, True) but it says expected = Commented Jun 24, 2014 at 8:11
  • You add the module, not the variable. Commented Jun 24, 2014 at 8:44
  • So do I run this sc.AddObject "frmSDI", frmSDI, True ? Because, it didn't work........it says variable not defined for frmSDI Commented Jun 24, 2014 at 8:57
  • I postedthe docs. It's your module's name not mine. Commented Jun 25, 2014 at 4:30

1 Answer 1

1

Makes run-time functionality available to a scripting engine.

Syntax

ScriptControl.AddObject(name, object[, addMembers])

The AddObject method has these parts:

Part Description

name    Required. Name by which the added object is to be known in ScriptControl code.
object  Required. Name of the object exposed at run time.
addMembers  Optional. Boolean value. True if members of object are globally accessible; False if they are not.

Remarks

Use the AddObject method to make run-time functionality available to a scripting engine. The AddObject method enables a ScriptControl user to provide a set of name/object pairs to the scripting code. The scripting engines may expose the name in any way. In both VBScript and JScript, each name appears as a globally accessible name.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.