I am trying to automate an employee webpage. I have some VBA
experience but I do not have extensive knowledge of using VBA with
Internet Explorer. Unfortunately, the webpage I am trying to automate
is internal so I can?t give you the whole webpage information. I have
tried to supply the code that you need to answer my questions, but if
you need more, please let me know. Also, I do not even know if what I
am asking can be done, if not, please don?t answer. Please note, I am
trying to run this from excel (VBA). I have looked through all of the
usergroups but I haven?t found the answers to the following questions.
1. I am trying to insert employee identifiers on our webpage that has
insert boxes. However, the webpage has three different frames. Thus
I am unable to use the following code:
IE.frames("employee").document.all("name").Value = ?John?. Please
note, ?employee? is the name of a frame and ?name? is the name of the
input box.
I have found some code that you might need.
This was on one frame:
<SCRIPT>
var space = " ";
function isBlank(inVal) {
var inLen = inVal.length;
for ( var i = 0; i < inLen; i++ )
{
if ( inVal.charAt(i) != ' ' )
return false;
}
return true;
}
function isNotNum(date, position) {
var num = date.charAt(position);
return ( num < '0' || num > '9' || num == '-' );
}
function setErrorLevel(td) {
setSelectList(td, parent.frames[1].document.forms[0].level);
}
This was on another frame:
<SCRIPT>
function writeMessage(msg) {
var d = parent.frames[0].document; d.open();
d.writeln("<BODY>");
d.write("<H4 align=center><SPAN style='font-family: times; font-size: 12pt;'>");
d.write(msg);
d.writeln("</SPAN></H4>");
d.writeln("</BODY>");
d.close(); }
</SCRIPT>
2. Because the webpage has several frames when loading, I have a
problem with the following loading message:
Do While IE.busy
Loop
It seems that when one of the frames loads, the webpage lists ?Done?
in the statusbar before it proceeds to download the next frame. Thus,
the ?Do while IE.busy? does not work in all instances. Is there
another way I can tell the Internet Explorer to wait until all the
frames have finished loading.
3. There is an employee ID on the webpage that I am trying to
automate. However, this employee ID is not within an input/text box.
It is merely, listed on the webpage. I need to be able to find the
specific number (please note: I will not have the number, the macro
has to locate it.) The number is always in the same place on the
webpage. I have identified the specific line in the html code
<TD CLASS=line-b>123456</TD> ?The 123456 is where the employee id is located.
4. I am currently using the following statement to tab through the website
DoEvents
Call SendKeys("{tab}")
DoEvents
Call SendKeys("{enter}")
The reason I am doing this is that one of the submit buttons does not
have a name associated with it. Thus I have to tab to the button and
then hit enter. Is there a simpler code I can use, such as
ie.sendkeys (?{tab}?). Using the DoEvents, will sometimes send the
tab button to excel and not internet explorer.
5. Whenever I run the macro, it takes uses up all of the processing
from the computer, why is this? The beginning of the macro begins
with this:
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
I have a similar macro that works on a seperate webpage (without
frames) and I am still able to run other processes while the macro is
running.
Thanks for your help!!! |