Web browser question
What Mr. Shetty was talking about was navigationg with instance of IE.
You are trying it for the WebQuery.
It won't work with WebQuery.
Your choices are.
1. First manually open the site and login. Keep the site open, then run
webquery. (Which I think you do at present, is that correct?)
2. If above is correct then before the web query refresh, through VBA code
you start IE, navigate to the url. As Mr. Shetty says, you supply the
username and password through the code. (I don't know exactly how, I hope
Mr. Shetty will inform this.). Leave the navigated site open.
Then run your web query with Worksheets("xyz").QueryTables(1).Refresh
For opening the webpage through excel:
In your VBA project add reference to "Microsoft Internet Control".
Code could be as under:-
Dim IE As InternetExplorer, nCount as Long
Set IE = New InternetExplorer
IE.Navigate "http://in.finance.yahoo.com/p?v&k=pf_2&d=v6"
'code for username/pwd , I don't know how.
IE.Visible = True
'now allow some time for IE to navigate and login
'below loop will give it 10 sec.
nCount = Timer
Do While Timer < nCount + 10
DoEvents
Loop
'Then refresh your webquery
Worksheets("xyz").QueryTables(1).Refresh
'Allow about 30s for query refresh
nCount = Timer
Do While Timer < nCount + 30
DoEvents
Loop
'Then close IE
IE.Quit
"R.VENKATARAMAN" &&& wrote in message
...
thank you Mr.shetty;. I got the code for submit also. but I do not know
how
to dovetail thee codes into the vba statement
my code call the url b this statement
====
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://in.finance.yahoo.com/p?v&k=pf_2&d=v6",
Destination:=Range("B5"))
.Name = "p?v&k=pf_2&d=v6"
etc.
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
etc etc
yahoo sometimes call for logging in.
==================
I tried to place the following code statements in the beginning before the
above statements. that does not seem to help.
Dim login
Dim passwd
Dim submit As Boolean
login = "venkat1926"
passwd = InputBox("type password")
submit = True
thanks for all the help
Shetty wrote in message
oups.com...
YA, IT IS LOGIN AND PASSWD.
YOU CAN USE IT IN YOUR VBA CODE TO SUPPLY THE VALUES.
ALSO YOU NEED TO FIND OUOT THE CODE NAME FOR SUBMIT BUTTON TO SUBMIT
THE FROM PROGRAMATICALLY.
REGARDS,
SHETTY.
|