Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default VBA and Internet Explorer

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default VBA and Internet Explorer

Hi Joel

I've changed the .visible to true so I can see it - and it dosn't change to
"No" therefore the problem is not with the submit statement, but the value
statement. I thought it was maybe because I had to use something like
..listindex rather than value?

Thanks for your time
Jamie

"Joel" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default VBA and Internet Explorer

I don't think you have the correct object selected. The form is just using
the default value. Another method is if the URL is different between Yes
and No then just go to the predefined URL.

"Jamie" wrote:

Hi Joel

I've changed the .visible to true so I can see it - and it dosn't change to
"No" therefore the problem is not with the submit statement, but the value
statement. I thought it was maybe because I had to use something like
.listindex rather than value?

Thanks for your time
Jamie

"Joel" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default VBA and Internet Explorer

Hi Joes

Thanks for the suggestion. I dont think the URL is different.
IS there a bit code I can run to get the names of all the objects on the page?

This is the code specific to the object:

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


Is it maybe %%Surrogate_kwdshowphoto?

Thanks
Jamie



"Joel" wrote:

I don't think you have the correct object selected. The form is just using
the default value. Another method is if the URL is different between Yes
and No then just go to the predefined URL.

"Jamie" wrote:

Hi Joel

I've changed the .visible to true so I can see it - and it dosn't change to
"No" therefore the problem is not with the submit statement, but the value
statement. I thought it was maybe because I had to use something like
.listindex rather than value?

Thanks for your time
Jamie

"Joel" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default VBA and Internet Explorer

Does the box show the ouble quotes around YES ? If you manually go to the
page and select No does it work? I thinking that Yes may be 1 and No may be
0.
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default VBA and Internet Explorer

Hi mate

No the box dosn't show the quotes. If I click No it does work. I did try 0
and 1 but no luck.
I did get a workaround by doing objIE.document.all("kwdshowphoto").focus
then sendkeys "N"
but its still annoying :-(

Thanks for your time, appreciated

"Joel" wrote:

Does the box show the ouble quotes around YES ? If you manually go to the
page and select No does it work? I thinking that Yes may be 1 and No may be
0.

"Jamie" wrote:

Hi Joel

On further inspection, it is the correct object - debugging the code I can
see thatwhen I run the line which sets the value to "No" the dropdown box
goes blank - then when its submitted, it reverts to the default "Yes" as you
suggested.

Any ideas why it dos't like the "No"? Maybe because of the "hidden=1" part
in the source?

Thanks

"Jamie" wrote:

Hi Joes

Thanks for the suggestion. I dont think the URL is different.
IS there a bit code I can run to get the names of all the objects on the page?

This is the code specific to the object:

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

Is it maybe %%Surrogate_kwdshowphoto?

Thanks
Jamie



"Joel" wrote:

I don't think you have the correct object selected. The form is just using
the default value. Another method is if the URL is different between Yes
and No then just go to the predefined URL.

"Jamie" wrote:

Hi Joel

I've changed the .visible to true so I can see it - and it dosn't change to
"No" therefore the problem is not with the submit statement, but the value
statement. I thought it was maybe because I had to use something like
.listindex rather than value?

Thanks for your time
Jamie

"Joel" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet explorer Atishoo Excel Programming 1 October 16th 08 04:13 AM
Internet Explorer da Excel Discussion (Misc queries) 4 October 9th 08 09:31 PM
internet explorer instance Manoj Excel Discussion (Misc queries) 0 February 1st 06 09:56 AM
Internet explorer download/XP Pro?? Maxwell-5000 Excel Discussion (Misc queries) 1 January 3rd 06 10:03 PM
internet explorer doris Excel Discussion (Misc queries) 1 January 5th 05 09:44 PM


All times are GMT +1. The time now is 11:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"