views:

79

answers:

1

assume that I have a html file in which javascript like this

<script type="text/javascript">
    var test1 = 1;
    var test2 = 2;
    var tset3 = 3;
</script>

So, how can I get javascript variables by excel vba and use it in excel vba?

A: 
  1. You can read the html file first, use open file in VBA and save it in a string variable.
  2. Then, you should parse the string variable line by line to get any substring var xxx = yyy, use instr and loop method to get the variable name and its value.
Zai