Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用VBA导入Java脚本对象_Javascript_Html_Excel_Scrape_Vba - Fatal编程技术网

Javascript 使用VBA导入Java脚本对象

Javascript 使用VBA导入Java脚本对象,javascript,html,excel,scrape,vba,Javascript,Html,Excel,Scrape,Vba,我正在尝试使用VBA从JavaScript命令中获取输出 不幸的是,我有点不知所措。我已经尝试了.getElementsByTagNamescript4.innertext,但我得到的只是[object] 请参阅下面的HTML。我正在尝试提取数据数组的。任何帮助都将不胜感激 干杯 <script type="text/javascript"> var _chartit_hco_array = [ { "series": [

我正在尝试使用VBA从JavaScript命令中获取输出

不幸的是,我有点不知所措。我已经尝试了.getElementsByTagNamescript4.innertext,但我得到的只是[object]

请参阅下面的HTML。我正在尝试提取数据数组的。任何帮助都将不胜感激

干杯

    <script type="text/javascript">
      var _chartit_hco_array = [
    {
        "series": [
            {
                "stacking": false,
                "data": [
                    4006,
                    34940.1034,
                    61062.5161,
                    95107.6333,
                    167971.8,
                    218549.129,
                    272389.2143,
                    288584.7097,
                    317959.5
                ],
                "type": "column",
                "name": "Dau"
            }
        ],
        "yAxis": [
            {
                "title": {
                    "text": "Daily Active Users (DAU)"
                }
            }
        ],
        "chart": {
            "renderTo": "dauchart_container"
        },
        "xAxis": [
            {
                "categories": [
                    "May<br>2013",
                    "Jun<br>2013",
                    "Jul<br>2013",
                    "Aug<br>2013",
                    "Sep<br>2013",
                    "Oct<br>2013",
                    "Nov<br>2013",
                    "Dec<br>2013",
                    "Jan<br>2014"
                ],
                "title": {
                    "text": "Date"
                }
            }
        ],
        "title": {
            "text": "Daily Active Users (Monthly avg.)"
        }
    },
    {
        "series": [
            {
                "stacking": false,
                "data": [
                    12456.96,
                    204106.3103,
                    320728.5161,
                    442251.9333,
                    646994.0333,
                    1017031.3226,
                    1232705.2857,
                    1377097.3871,
                    1432762.5
                ],
                "type": "column",
                "name": "Mau",
                "label": {
                    "text": "Light breeze",
                    "style": {
                        "color": "#606060"
                    }
                }
            }
        ],
        "yAxis": [
            {
                "title": {
                    "text": "Monthly Active Users (MAU)"
                }
            }
        ],
        "chart": {
            "renderTo": "mauchart_container"
        },
        "xAxis": [
            {
                "categories": [
                    "May<br>2013",
                    "Jun<br>2013",
                    "Jul<br>2013",
                    "Aug<br>2013",
                    "Sep<br>2013",
                    "Oct<br>2013",
                    "Nov<br>2013",
                    "Dec<br>2013",
                    "Jan<br>2014"
                ],
                "title": {
                    "text": "Date"
                }
            }
        ],
        "title": {
            "text": "Monthly Active Users (Monthly avg.)"
        }
    },
    {
        "series": [
            {
                "stacking": false,
                "data": [
                    36.904,
                    18.963103,
                    18.939677,
                    21.466333,
                    25.936,
                    21.515806,
                    22.113929,
                    20.959032,
                    22.19
                ],
                "type": "column",
                "name": "Dau2Mau Percent"
            }
        ],
        "yAxis": [
            {
                "title": {
                    "text": "Daily / Monthly Active Users (DAU/MAU)"
                }
            }
        ],
        "chart": {
            "renderTo": "dau2mauchart_container"
        },
        "xAxis": [
            {
                "categories": [
                    "May<br>2013",
                    "Jun<br>2013",
                    "Jul<br>2013",
                    "Aug<br>2013",
                    "Sep<br>2013",
                    "Oct<br>2013",
                    "Nov<br>2013",
                    "Dec<br>2013",
                    "Jan<br>2014"
                ],
                "title": {
                    "text": "Date"
                }
            }
        ],
        "title": {
            "text": "DAU as percentage of MAU (Monthly avg.)"
        }
    },
    {
        "series": [
            {
                "stacking": false,
                "data": [
                    11057.24,
                    104310.5862,
                    153653.3226,
                    222996.8667,
                    392113.7,
                    546472.0645,
                    674174.0714,
                    710372.6774,
                    771079.5
                ],
                "type": "column",
                "name": "Wau"
            }
        ],
        "yAxis": [
            {
                "title": {
                    "text": "Weekly Active Users (WAU)"
                }
            }
        ],
        "chart": {
            "renderTo": "wauchart_container"
        },
        "xAxis": [
            {
                "categories": [
                    "May<br>2013",
                    "Jun<br>2013",
                    "Jul<br>2013",
                    "Aug<br>2013",
                    "Sep<br>2013",
                    "Oct<br>2013",
                    "Nov<br>2013",
                    "Dec<br>2013",
                    "Jan<br>2014"
                ],
                "title": {
                    "text": "Date"
                }
            }
        ],
        "title": {
            "text": "Weekly Active Users (Monthly avg.)"
        }
    }
];</script>

你几乎是对的,你必须做到:

document.getElementsByTagName("script")(4).innerText;   //Check the uppercase T in innerText
如果它返回空字符串,则表示脚本来自其他域,如果是这种情况,则无法获取它


干杯

你能控制html吗?如果是这样的话,在jscript中转换成CSV并将其导入VBA会容易得多。。。
    <script type="text/javascript">
      var _chartit_hco_array = [
    {
        "series": [
            {
                "stacking": false,
                "data": [
                    4006,
                    34940.1034,
                    61062.5161,
                    95107.6333,
                    167971.8,
                    218549.129,
                    272389.2143,
                    288584.7097,
                    317959.5
                ],
                "type": "column",
                "name": "Dau"
            }
        ],
        "yAxis": [
            {
                "title": {
                    "text": "Daily Active Users (DAU)"
                }
            }
        ],
        "chart": {
            "renderTo": "dauchart_container"
        },
        "xAxis": [
            {
                "categories": [
                    "May<br>2013",
                    "Jun<br>2013",
                    "Jul<br>2013",
                    "Aug<br>2013",
                    "Sep<br>2013",
                    "Oct<br>2013",
                    "Nov<br>2013",
                    "Dec<br>2013",
                    "Jan<br>2014"
                ],
                "title": {
                    "text": "Date"
                }
            }
        ],
        "title": {
            "text": "Daily Active Users (Monthly avg.)"
        }
    },
    {
        "series": [
            {
                "stacking": false,
                "data": [
                    12456.96,
                    204106.3103,
                    320728.5161,
                    442251.9333,
                    646994.0333,
                    1017031.3226,
                    1232705.2857,
                    1377097.3871,
                    1432762.5
                ],
                "type": "column",
                "name": "Mau",
                "label": {
                    "text": "Light breeze",
                    "style": {
                        "color": "#606060"
                    }
                }
            }
        ],
        "yAxis": [
            {
                "title": {
                    "text": "Monthly Active Users (MAU)"
                }
            }
        ],
        "chart": {
            "renderTo": "mauchart_container"
        },
        "xAxis": [
            {
                "categories": [
                    "May<br>2013",
                    "Jun<br>2013",
                    "Jul<br>2013",
                    "Aug<br>2013",
                    "Sep<br>2013",
                    "Oct<br>2013",
                    "Nov<br>2013",
                    "Dec<br>2013",
                    "Jan<br>2014"
                ],
                "title": {
                    "text": "Date"
                }
            }
        ],
        "title": {
            "text": "Monthly Active Users (Monthly avg.)"
        }
    },
    {
        "series": [
            {
                "stacking": false,
                "data": [
                    36.904,
                    18.963103,
                    18.939677,
                    21.466333,
                    25.936,
                    21.515806,
                    22.113929,
                    20.959032,
                    22.19
                ],
                "type": "column",
                "name": "Dau2Mau Percent"
            }
        ],
        "yAxis": [
            {
                "title": {
                    "text": "Daily / Monthly Active Users (DAU/MAU)"
                }
            }
        ],
        "chart": {
            "renderTo": "dau2mauchart_container"
        },
        "xAxis": [
            {
                "categories": [
                    "May<br>2013",
                    "Jun<br>2013",
                    "Jul<br>2013",
                    "Aug<br>2013",
                    "Sep<br>2013",
                    "Oct<br>2013",
                    "Nov<br>2013",
                    "Dec<br>2013",
                    "Jan<br>2014"
                ],
                "title": {
                    "text": "Date"
                }
            }
        ],
        "title": {
            "text": "DAU as percentage of MAU (Monthly avg.)"
        }
    },
    {
        "series": [
            {
                "stacking": false,
                "data": [
                    11057.24,
                    104310.5862,
                    153653.3226,
                    222996.8667,
                    392113.7,
                    546472.0645,
                    674174.0714,
                    710372.6774,
                    771079.5
                ],
                "type": "column",
                "name": "Wau"
            }
        ],
        "yAxis": [
            {
                "title": {
                    "text": "Weekly Active Users (WAU)"
                }
            }
        ],
        "chart": {
            "renderTo": "wauchart_container"
        },
        "xAxis": [
            {
                "categories": [
                    "May<br>2013",
                    "Jun<br>2013",
                    "Jul<br>2013",
                    "Aug<br>2013",
                    "Sep<br>2013",
                    "Oct<br>2013",
                    "Nov<br>2013",
                    "Dec<br>2013",
                    "Jan<br>2014"
                ],
                "title": {
                    "text": "Date"
                }
            }
        ],
        "title": {
            "text": "Weekly Active Users (Monthly avg.)"
        }
    }
];</script>