Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Internet explorer | Excel Programming | |||
Internet Explorer | Excel Discussion (Misc queries) | |||
internet explorer instance | Excel Discussion (Misc queries) | |||
Internet explorer download/XP Pro?? | Excel Discussion (Misc queries) | |||
internet explorer | Excel Discussion (Misc queries) |