Solved

VBA - Auto Fill Web Page - Click Image

Posted on 2013-11-29
2
1,300 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now