Solved

VBA - Auto Fill Web Page - Click Image

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

759 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

19 Experts available now in Live!

Get 1:1 Help Now