Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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
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 workbook in explorer frame valeriy Excel Programming 0 September 26th 06 12:52 PM
Excel/VBA/Internet Explorer Alex[_30_] Excel Programming 1 November 22nd 05 05:09 PM
Excel Macro cannot Run at Internet Explorer 6 WCNW Excel Programming 1 August 17th 05 03:51 AM
Internet Explorer & Excel David Excel Programming 0 February 4th 05 08:51 PM
Calling an Excel Doc from Internet Explorer Sven Schulze Excel Programming 0 February 25th 04 10:10 AM


All times are GMT +1. The time now is 02:52 AM.

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"