0

I tried to change value with below code but error occurred. Error message is 'sheet1 is not defined'. When i put text ex) "25-Sep-2020", it worked well.

Set ele = bot.FindElementByXPath("//tr//tr//tr//tr//tr//tr//tr//tr//tr[2]//td[2]//span[1]//span[1]//table[1]//tbody[1]//tr[1]//td[1]//span[1]//table[1]//tbody[1]//tr[1]//td[1]//input[1]")

attrScript = "arguments[0].setAttribute('value', sheet1.range ['B2'])"

bot.ExecuteScript attrScript, ele

Thank you in advcane.

1 Answer 1

2

I'm not exactly sure what you're trying to do but it seems you're mixing Javascript code (not Java!) and calling it from VBA through the SeleniumBasic library.

You can't call sheet1.range from Javascript code. It won't know what to do with it. You need to unquote that part so it can be handled by VBA instead of by Javascript.

attrScript = "arguments[0].setAttribute('value', " & sheet1.range ['B2'] & ")"
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.