View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default VBA and Internet Explorer

Can you see on the webpage if No is getting enter in the form?

Why arre you using CALL. Does it work without call?

from
Call objIE.Document.Forms(0).Submit
to
objIE.Document.Forms(0).Submit


"Jamie" wrote:

Hi guys

I have a simple bit of code which opens up Internet Explorer, navigates to a
web page, selects a value from a drop down menu (options are either "Yes" or
"No") and submits the form.

The code works fine if it is selecting "Yes" however if I change it to "No"
it dosn't work. Here is my code:

Sub photo_select()

strURL =
"http://corporate1.internal.standardlife.com/phoneline/Phnline.nsf/frmStaffUpdate"
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate strURL
objIE.Visible = False

While objIE.ReadyState < 4
Application.Wait Now + TimeValue("00:00:01")
Wend

objIE.Document.all("kwdshowphoto").Value = "Yes"

Call objIE.Document.Forms(0).Submit

objIE.Quit

End Sub

Here is part of the source code of the internal website, which relates to
the drop down:

<table border="0" width="100%" cellspacing="0" cellpadding="0"<a
width="100%" border="0" cellspacing="0" cellpadding="0"
<tr valign="top"<td class="sectionHead" width="350"<a width="1%"<img
width="359" height="1" src="/icons/ecblank.gif" border="0" alt=""<br
My location data / PhoneLine photo</td<td class="sectionHead" <a
width="100%"<img width="1" height="1" src="/icons/ecblank.gif" border="0"
alt=""<br
<div align="right"<a href="javascript:PhonelineHelp();" class="globalNav"
title="launch phoneline help"Help</a </div</td</tr

<tr valign="top"<td width="350"<a width="1%"<img width="359" height="1"
src="/icons/ecblank.gif" border="0" alt=""<br
</td<td <a width="100%"<img width="1" height="1" src="/icons/ecblank.gif"
border="0" alt=""<br
<br</td</tr

<tr valign="top"<td class="labelText" width="350"<a width="1%"<img
width="359" height="1" src="/icons/ecblank.gif" border="0" alt=""<br
Show my photo on Phoneline :</td<td class="dataText" <a width="100%"<img
width="1" height="1" src="/icons/ecblank.gif" border="0" alt=""<br
<font size="2"
<input name="%%Surrogate_kwdShowPhoto" type="hidden" value="1"
<select name="kwdShowPhoto"
<optionYes
<option selectedNo</select
</font </td</tr

<tr valign="top"<td width="1%"<img width="359" height="1"
src="/icons/ecblank.gif" border="0" alt=""<br
</td<td width="100%"<img width="1" height="1" src="/icons/ecblank.gif"
border="0" alt=""<br
<br</td</tr

Thanks in advance
Jamie