Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting frame in Internet Explorer from Excel
I am trying to logon to a website from the Excel Macro, but cannot get it to
use the correct frame on the web page. There seems to be 2 main frames to the webpage, the login and password one, that I'm trying to use, and then the rest of the page. Below is the code I am using, I got it from another thread in the discussion group. Sub Open_Website() Set IExplorer = CreateObject("InternetExplorer.Application") IExplorer.Visible = True IExplorer.navigate "http://avotus/avotus/" Do While IExplorer.Busy And Not IExplorer.ReadyState = 4: Application.Wait (Now + TimeValue("0:00:02")) DoEvents Loop With Selection IExplorer.document.all("Login").Value = "sl704d" IExplorer.document.all("Password").Value = "******" IExplorer.document.forms(0).submit End With End Sub It opens the webpage perfectly, but gives me an error at the With Selection line. I have managed to save the HTML for just the login frame and I have run the macro successfully against this, so I'm thinking that it's not identifying the frames on the webpage right. My HTML programming is very limited, so that's maybe my biggest problem. Thank's in advance for any help. -- Cheers... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting frame in Internet Explorer from Excel
Hi Deke,
I'm not very clued up on navigating in IE, but have done some interesting digging and found the following link: http://www.dailydoseofexcel.com/arch...rnet-explorer/ If you're trying to target a specific frame then you might want to try looping through the frames to check the name of the one you're after: For x = 0 To IExplorer.Document.Frames.Length - 1 Debug.Print IExplorer.Document.Frames(x).Name Next x You could then target the correct frame with something like: IExplorer.Document.Frames("fraTarget").Document... ... Also, its worth stepping through your code (F8) as once you've got a reference to the document you can explore all of the elements via the Locals window. Anyway, hope that helps. Best regards John "Deke" wrote in message ... I am trying to logon to a website from the Excel Macro, but cannot get it to use the correct frame on the web page. There seems to be 2 main frames to the webpage, the login and password one, that I'm trying to use, and then the rest of the page. Below is the code I am using, I got it from another thread in the discussion group. Sub Open_Website() Set IExplorer = CreateObject("InternetExplorer.Application") IExplorer.Visible = True IExplorer.navigate "http://avotus/avotus/" Do While IExplorer.Busy And Not IExplorer.ReadyState = 4: Application.Wait (Now + TimeValue("0:00:02")) DoEvents Loop With Selection IExplorer.document.all("Login").Value = "sl704d" IExplorer.document.all("Password").Value = "******" IExplorer.document.forms(0).submit End With End Sub It opens the webpage perfectly, but gives me an error at the With Selection line. I have managed to save the HTML for just the login frame and I have run the macro successfully against this, so I'm thinking that it's not identifying the frames on the webpage right. My HTML programming is very limited, so that's maybe my biggest problem. Thank's in advance for any help. -- Cheers... |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting frame in Internet Explorer from Excel
John,
That worked perfectly, I'm now logged into the website. Thank you very much for your help. Cheers... "John" wrote: Hi Deke, I'm not very clued up on navigating in IE, but have done some interesting digging and found the following link: http://www.dailydoseofexcel.com/arch...rnet-explorer/ If you're trying to target a specific frame then you might want to try looping through the frames to check the name of the one you're after: For x = 0 To IExplorer.Document.Frames.Length - 1 Debug.Print IExplorer.Document.Frames(x).Name Next x You could then target the correct frame with something like: IExplorer.Document.Frames("fraTarget").Document... ... Also, its worth stepping through your code (F8) as once you've got a reference to the document you can explore all of the elements via the Locals window. Anyway, hope that helps. Best regards John "Deke" wrote in message ... I am trying to logon to a website from the Excel Macro, but cannot get it to use the correct frame on the web page. There seems to be 2 main frames to the webpage, the login and password one, that I'm trying to use, and then the rest of the page. Below is the code I am using, I got it from another thread in the discussion group. Sub Open_Website() Set IExplorer = CreateObject("InternetExplorer.Application") IExplorer.Visible = True IExplorer.navigate "http://avotus/avotus/" Do While IExplorer.Busy And Not IExplorer.ReadyState = 4: Application.Wait (Now + TimeValue("0:00:02")) DoEvents Loop With Selection IExplorer.document.all("Login").Value = "sl704d" IExplorer.document.all("Password").Value = "******" IExplorer.document.forms(0).submit End With End Sub It opens the webpage perfectly, but gives me an error at the With Selection line. I have managed to save the HTML for just the login frame and I have run the macro successfully against this, so I'm thinking that it's not identifying the frames on the webpage right. My HTML programming is very limited, so that's maybe my biggest problem. Thank's in advance for any help. -- Cheers... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel workbook in explorer frame | Excel Programming | |||
Excel/VBA/Internet Explorer | Excel Programming | |||
Excel Macro cannot Run at Internet Explorer 6 | Excel Programming | |||
Internet Explorer & Excel | Excel Programming | |||
Calling an Excel Doc from Internet Explorer | Excel Programming |