Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 118
Default ipf.value question

I need to select a timezone on a webpage. In the past, the code for
that page had something like
<select name="timezone"
<option value="Eastern"
<option value="Central"
and so on. The following commands worked fine in my macro to select
the desired timezone on the webpage
Set ipf = ie.document.all.Item("timezone")
ipf.Value = "Eastern"

Now the code behind the webpage has been updated and the timezone code
reads as follows
<select name="timezone"
<option selectedEastern
<optionCentral
<optionMountain
<optionPacific

The "ipf.value" command no longer selects the correct timezone. Any
thoughts on how to accomplish this selection with the new webpage
code?..Thanks in advance, Ron

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default ipf.value question

This is an excel group.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"ron" wrote in message
oups.com...
I need to select a timezone on a webpage. In the past, the code for
that page had something like
<select name="timezone"
<option value="Eastern"
<option value="Central"
and so on. The following commands worked fine in my macro to select
the desired timezone on the webpage
Set ipf = ie.document.all.Item("timezone")
ipf.Value = "Eastern"

Now the code behind the webpage has been updated and the timezone code
reads as follows
<select name="timezone"
<option selectedEastern
<optionCentral
<optionMountain
<optionPacific

The "ipf.value" command no longer selects the correct timezone. Any
thoughts on how to accomplish this selection with the new webpage
code?..Thanks in advance, Ron



  #3   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 118
Default ipf.value question

That's why I'm posting here. I use "set ipf" and "ipf.value" in many
of my Excel macros. They have been discussed in this newsgroup in the
past...Ron

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default ipf.value question

Ron,

You'll need to loop through the options, find the one with .text = "Eastern"
and set the selectedIndex of the list to the index of that option (they
start at 0)

something like (untested)


Function SetSelect(s,val) as boolean
dim x as integer
dim r as boolean

r=false
for x=0 to s.options.length-1
if s.options(x).text = val then
s.selectedIndex=x
r=true
exit for
end if
next x

SetSelect=r

end function


usage:
if not SetSelect(ipf,"Eastern") then
'something went wrong
else
'continue...
end if


Tim.




"ron" wrote in message
oups.com...
I need to select a timezone on a webpage. In the past, the code for
that page had something like
<select name="timezone"
<option value="Eastern"
<option value="Central"
and so on. The following commands worked fine in my macro to select
the desired timezone on the webpage
Set ipf = ie.document.all.Item("timezone")
ipf.Value = "Eastern"

Now the code behind the webpage has been updated and the timezone code
reads as follows
<select name="timezone"
<option selectedEastern
<optionCentral
<optionMountain
<optionPacific

The "ipf.value" command no longer selects the correct timezone. Any
thoughts on how to accomplish this selection with the new webpage
code?..Thanks in advance, Ron



  #5   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 118
Default ipf.value question

Thanks Tim for the example and explanation! It got me back up and
running...Many thanks, Ron

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
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


All times are GMT +1. The time now is 07:49 PM.

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

About Us

"It's about Microsoft Excel"