I'm trying to automate several web queries in MS EXCEL VBA for an app I'm building at work basically as a MACRO to assemble information from our corprate web sites. I assume they use server side scripting because the documents are all presented under a single URL with no parameters. As a result the EXCEL web query method is impossible. I am able to programatically open the required sites, but there are layers upon layers of navigation required to reach the desired output. On the opening page, however, there is an .onclick function that holds a parameter string used to call specified documents. The code and web information are sensitive so I cannot post any real code, but the .onclick looks a lot like this in the source:
我正在尝试在MS EXCEL VBA中为我正在构建的应用程序中的几个Web查询进行自动化,这些应用程序基本上是作为MACRO从我们的公司网站收集信息。我假设他们使用服务器端脚本,因为文档都是在没有参数的单个URL下呈现的。因此,EXCEL Web查询方法是不可能的。我能够以编程方式打开所需的站点,但是在达到所需输出所需的导航层上有层。但是,在开始页面上,有一个.onclick函数,它包含一个用于调用指定文档的参数字符串。代码和Web信息是敏感的,所以我不能发布任何真正的代码,但.onclick在源代码中看起来很像这样:
IEdoc.TD.item(i).onclick="fnFtch('MBSOVY07OZ-LIMO/TVDBLDAT#WNISAZÿNÿALLÿTÿIÿÿ ÿ24ÿ ÿÿ ÿ ÿÿ ÿÿ ÿMÿÿNÿNO');"
If I assign it a variable like this:
如果我为它分配一个这样的变量:
strgvar = IEdoc.TD.item(i).onclick or set objvar = IEdoc.TD.item(i).onclick
The result is more like:
结果更像是:
function(){'fnFtch('MBSOVY07OZ-LIMO/TVDBLDAT#WNISAZÿNÿALLÿTÿIÿÿ ÿ24ÿ ÿÿ ÿ ÿÿ ÿÿ ÿMÿÿNÿNO');'}
I want to change the part of the string following the "#" to the parameters I would eventually end up with following several pages of programatic navigation. Went I replace the unwanted portion with the string I want, .click ceases to do anything. It's obvious to me that I'm mixing "string" and "object" properties because if I do this:
我想将“#”后面的字符串部分更改为我最终会在几页程序导航后最终得到的参数。我用我想要的字符串替换不需要的部分,.click停止做任何事情。对我来说很明显,我正在混合“字符串”和“对象”属性,因为如果我这样做:
Set objvar = IEdic.TD.item(i).onclick
strgvar = objvar
IEdoc.TD.item(i).onclick = strgvar
The .click fails to work.
.click失败了。
If I leave everything "object" type like this:
如果我留下所有“对象”类型如下:
Set objvar = IEdoc.TD.item(i).onclick
IEdoc.TD.item(i).onclick = objvar
The .click still works None of this codes returns a "Type mismatch" error, it just renders the .click inert
.click仍然有效这些代码都没有返回“类型不匹配”错误,它只是呈现.click惰性
2 个解决方案
#1
0
Have you tried using navigate and Document.documentElement.innerHTML to read the text on the page? I used FireBug to trace one website and had to go to two pages for every page that you saw (first page was the "request", the second page actually gave you the content). Very cumbersome, but I got it to work with Navigate.
您是否尝试使用navigate和Document.documentElement.innerHTML来阅读页面上的文本?我使用FireBug跟踪一个网站,并且对于您看到的每个页面都必须转到两页(第一页是“请求”,第二页实际上是为您提供了内容)。非常麻烦,但我得到它与Navigate一起工作。
#2
0
FireEvent
is used to trigger the event attached to any element. Try below code.
FireEvent用于触发附加到任何元素的事件。试试下面的代码。
Set objvar = IEdic.TD.item(i)
objvar.FireEvent("onclick")
#1
0
Have you tried using navigate and Document.documentElement.innerHTML to read the text on the page? I used FireBug to trace one website and had to go to two pages for every page that you saw (first page was the "request", the second page actually gave you the content). Very cumbersome, but I got it to work with Navigate.
您是否尝试使用navigate和Document.documentElement.innerHTML来阅读页面上的文本?我使用FireBug跟踪一个网站,并且对于您看到的每个页面都必须转到两页(第一页是“请求”,第二页实际上是为您提供了内容)。非常麻烦,但我得到它与Navigate一起工作。
#2
0
FireEvent
is used to trigger the event attached to any element. Try below code.
FireEvent用于触发附加到任何元素的事件。试试下面的代码。
Set objvar = IEdic.TD.item(i)
objvar.FireEvent("onclick")