473,394 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Automating Internet Explorer from Access

2
Hello,

I'm trying to automate a search function on a company website and pull back the results into access or excel. I can get access to open an instance of Internet Explorer, navigate to the correct page, fill in the appropriate text box, but when I try to tell it to click the search button or submit the form, it fails. There's no error or response from the site. It looks like it refreshes quickly, but it doesn't display the results. When I manually click the button, it displays results.

Applications:
MS Access 2003
Internet Explorer 8.0.6001.18702

The source information from the website is attached.

Below is the section where the search button is located.

Expand|Select|Wrap|Line Numbers
  1. <div class='modalwindowbuttons'>
  2.             <input type='hidden' name='action' value='search'>
  3.             <input type='submit' name='Search' value='Search'>
  4.         </div>
  5.  
And here's my VB module to test:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Private Function testIE()
  4.  
  5.     Dim sURL As String
  6.     Dim oIE As InternetExplorer
  7.     Dim oElement As Object
  8.     Dim oCollection As Object
  9.  
  10.     Dim sAccount As String
  11.     Dim oAcct As Object
  12.     Dim i As Integer
  13.  
  14.     sURL = "http://<removed>/ACHDispute/index.php?page=disputeform&action=search"
  15.     Set oIE = CreateObject("InternetExplorer.Application")
  16.  
  17.     oIE.NAVIGATE sURL
  18.     oIE.Visible = True
  19.     Do While oIE.busy Or oIE.READYSTATE <> 4
  20.         DoEvents
  21.     Loop
  22.  
  23.     sAccount = "#######"
  24.  
  25.     Set oAcct = oIE.Document.getElementsByName("acctnum")
  26.     oAcct.item(0).Value = sAccount
  27.  
  28.     oIE.Document.getElementById("Search").Click
  29.     oIE.Document.getElementById("searchForm").submit    
  30.  
  31. End Function
  32.  
It just doesn't want to react to the button click event or the form submit! Help!
Attached Files
File Type: txt achsite.txt (3.7 KB, 374 views)
Apr 10 '13 #1
1 3450
Alymon
2
I managed to work something out. It isn't pretty, but I use the IE object to move around the form and fill out the fields needed, then I use SendKeys to tab to the button (I couldn't focus on it using the IE object for some reason) and send a space character to trigger the button.

Expand|Select|Wrap|Line Numbers
  1.     Set oAcct = oIE.Document.getElementsByName("acctnum")
  2.     oAcct.item(0).Focus
  3.     oAcct.item(0).Value = sAccount
  4.  
  5.     oIE.Document.getElementsByName("disputeId").item(0).Focus
  6.  
  7.     SendKeys "{TAB}", True
  8.     dStart = Now()
  9.     dDate = Now()
  10.     Do Until dDate >= DateAdd("s", 2, dStart)
  11.          dDate = Now()
  12.     Loop
  13.  
  14.     SendKeys " ", True
  15.  
  16.     Do While oIE.busy Or oIE.READYSTATE <> 4
  17.         DoEvents
  18.     Loop
  19.  
  20.  
  21.     vString = oIE.Document.Body.InnerHTML
  22.  
  23.     Debug.Print vString
  24.  
Apr 11 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: SunshineGirl | last post by:
I'm trying to receive events from a running instance of Internet Explorer. So far I've only been able to receive events from an instance I launch from code, but I need to receive events from all...
3
by: Mark | last post by:
Hi all, Im written a small javascript program. Once it finishs I want to close the internet explorer page. I have used window.close(); when this runs it pops up with a Internet Explorer Dialog...
6
by: tinkerman | last post by:
Hello net friends, I need to automate Internet Explorer in a very simple way. I need to: 1. press refresh (F5) on the currently loaded website. 2. press END button. 3. Click a button...
2
by: Jax | last post by:
I am interested in finding out if it is possible with C# to manipulate IE to go to certain websites and act as a user I basically have a process I wish to automate but this process requires the...
10
by: milk-jam | last post by:
I'm trying to write a log which save each time internet explorer is opened or closed and all of the url which where visited? Any help is greatly appreciated.
3
by: ewhite2142 | last post by:
I am writing code in VB.Net to access data from the Internet. If I write the following code, I get access to a new instance of Internet Explorer: Imports SHDocVw Dim Br as New InternetExplorer...
1
by: chris_j_adams | last post by:
Hi, I'm trying to use Excel VBA ('97) to send details from an Excel sheet to a web page. I'm having some success but I've one issue that's proved difficult to find in the archives. There are...
4
by: attachmatey | last post by:
Greetings: I'm looking for some help in automating (what I thought would be) a simple procedure in Internet Explorer. I'm trying to put the following operation under a button click in an MS...
3
by: Matthew Lock | last post by:
Hello, I am automating Internet Explorer in order to do some simple automated testing of a web application. How do I invoke Javascript functions in the web page I load? I can successfully start...
26
by: Prisoner at War | last post by:
Hi, All: I have a JavaScript search engine that always causes MSIE 7 to do a top-of-page security "warning" (that top-of-page-bar, and not an "alert" )...but other websites' JavaScripts do not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.