Solved

VBA - Auto Fill Web Page - Click Image

Posted on 2013-11-29
2
1,322 Views
Last Modified: 2013-11-29
I'm attempting to auto complete a Web control embedded within an Excel form.  I'm having issues clicking the image button (which submits the form).  Web page code is below.

I think the issue is due to the type being "image."

Name of image on web form: aviaf_selectgroupbutton

Grasping for straws I've tried...
UserForm1.WebBrowser1.Document.forms(0).GetElementById("aviaf_selectgroupbutton").InvokeMember ("click")
UserForm1.WebBrowser1.Document.forms(0).submit
UserForm1.Document.forms(0).elements("aviaf_selectgroupbutton").Click



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My Data Views (prodrac)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="/WebFramework/styles/default.css" rel="stylesheet" type="text/css" />

</head>
<body bgcolor="#FFFFFF">
<form name="login" action="myDataView.asp" method="post">

<table width="100%" border="0">
<tr>
<td align="center">


<table width="652" border="0" cellspacing="2" cellpadding="0">
<tr> 
	<td valign="bottom" align="center"><img src="images/Banner.gif" alt="" title=" " border="0" /></td>
</tr>
<tr>
	<td class="r0b" align="center" height="30" background="images/bg2.gif">
		<b><font face="Arial" size="2">Please Select a  Data View</font></b>
	</td>
</tr>
<tr>
	<td align="center"  class="r2b">
		<table cellpadding="1" cellspacing="0" border="0">
		<tr>
			<td class="r2b">View:</td>
			<td class="r2b">
					<select name="client_id_user_group_id" style="font-family: arial">
					<option value="1:8">AVI Operations</option>
<option value="1:11">National - Read Only</option>

					</select>
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td align="right" background="images/bg2.gif" height="30">
		<input type="image" name="aviaf_selectgroupbutton" alt="SELECT-GROUP" title="Please select a group" src="images/select.gif" 
			onmouseout="this.src='images/select.gif'"  onmouseover="this.src='images/selectb.gif'" />
	</td>
</tr>
</table>
</td>
</tr>
</table>
<input type="hidden" name="app_id" value="3" />
<input type="hidden" name="app_url" value="" />
</form>
</body>

Open in new window

0
Comment
Question by:patriotpacer
2 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 39685630
How has the code you've tried failed?

Does this work?
Dim frm As Object

    Set frm = UserForm1.WebBrowser1.Document.forms(0)

    frm.submit

Open in new window

0
 

Author Closing Comment

by:patriotpacer
ID: 39685683
Good job, man!  That worked!

I've been banging my head against the wall.

thank you.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question