Assume that I have a html file in which the javascript code is like this:
<script type="text/javascript">
var test1 = 1;
var test2 = 2;
var tset3 = 开发者_如何学JAVA3;
</script>
How do I get the javascript variables via Excel VBA for use in Excel VBA macros?
- You can read the html file first, use
open file
in VBA and save it in astring
variable. - Then, you should parse the
string
variable line by line to get any substringvar xxx = yyy
, useinstr
andloop
method to get the variable name and its value.
精彩评论