0
한 번에 여러 계정의 내부 웹 사이트에서 일부 문서를 가져와야하는 프로세스를 자동화하려고합니다. 저는 Excel 2010에서 VBA를 사용하고 있습니다. 지금까지 이미지 버튼을 클릭해야하는 위치에 도달 할 때까지 탐색하고 로그인하는 코드를 만들 수있었습니다. 아래는 관련 소스 코드입니다.VBA를 사용하여 웹 사이트의 이미지 링크를 클릭하는 방법?
<LINK rel="stylesheet" type="text/css"
href="/crystalreportviewers10/css/default.css">
<table id="CrystalReportViewer1" cellpadding="0" cellspacing="0"
style="height:1043px;width:901px;Z-INDEX: 101;LEFT: 8px; POSITION: absolute; TOP: 8px">
<tr><td>
<div style="width: 901px; height: 1043px;position:relative">
<div style="height:30px;width:901px;top:0px;left:0px;">
<table class="crtoolbar" cellspacing=0 cellpadding=0><tr nowrap>
<td nowrap width=16> </td>
<td nowrap width=24px>
<input type="image" name="CrystalReportViewer1:_ctl2:_ctl0"
title="Show/Hide Group Tree"
onmouseover="this.src='/crystalreportviewers10/images/toolbar/grouptree_over.gif'"
onmouseout="this.src='/crystalreportviewers10/images/toolbar/grouptree.gif'"
src="/crystalreportviewers10/images/toolbar/grouptree.gif" alt="" border="0"
style="height:24px;width:24px;" /></td>
<td nowrap width=16> </td>
<td nowrap width=24px>
<img title="Print"
onclick="javascript:__doPostBack('CrystalReportViewer1:_ctl2:_ctl3','')"
onmouseover="this.src='/crystalreportviewers10/images/toolbar/print_over.gif'"
onmouseout="this.src='/crystalreportviewers10/images/toolbar/print.gif'"
src="/crystalreportviewers10/images/toolbar/print.gif" alt="" border="0"
style="height:24px;width:24px;" /></td>
나는 몇 가지 방법을 시도했다 : "Print.gif는"버튼을 클릭하는 것입니다 코드 블록이
<script language="javascript" type="text/javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document.Form1;
}
else {
theform = document.forms["Form1"];
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
그리고 아래로 건너 뛰는 : 우선 함수가 "onclick"을 발생시키지 만 위의 함수로 전달되어 올바른 페이지로 이동하는 것처럼 보이기 때문에 문제가 발생합니다. 지금까지 나는 시도했다 :
For Each obj In IE.Document.all
' MsgBox obj.innerHTML
If InStr(obj.innerHTML, "Print") > 0 Then
obj.Click
' Exit For
End If
Next
또는
For Each obj In IE.Document.all
If obj.Name = "Print" Then
obj.Click
Exit For
End If
Next
지금까지 나를 실패한 몇 변화. 이것에 대한 도움이 될 것입니다. 감사.