从URL提取的VBA

时间:2018-10-23 08:35:45

标签: html excel vba web-scraping

我正在尝试从URL中提取最后一页编号,我想获取最大页数。

bellow是我的网址

polyglot

下面是我尝试的VBA代码,但有些地方有问题

CMake Error at CMakeLists.txt:30 (FIND_PACKAGE):
  By not providing "FindVTK.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "VTK", but
  CMake did not find one.

  Could not find a package configuration file provided by "VTK" with any of
  the following names:

    VTKConfig.cmake
    vtk-config.cmake

  Add the installation prefix of "VTK" to CMAKE_PREFIX_PATH or set "VTK_DIR"
  to a directory containing one of the above files.  If "VTK" provides a
  separate development package or SDK, be sure it has been installed.


Configuring incomplete, errors occurred!
See also "C:/Users/MJ/Desktop/EvaluationMetrics/EvaluationMetrics/build_dir/CMakeFiles/CMakeOutput.log".

请任何人帮助我

1 个答案:

答案 0 :(得分:0)

您可以收集一个分页链接的nodeList,然后获取最后一个索引,即最大页码。您可以使用CSS后代组合器来实现此目的,以父元素的id为目标,然后以其中的a标签元素为目标。我使用-2来获取正确的索引,因为nodeList是基于0的索引。

Debug.Print html.querySelectorAll("#srchpagination a").item(html.querySelectorAll("#srchpagination a").Length - 2).innerText