Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Problem using internetexplorer object to open a url

I am trying to open a browser window from VBA and navigate to a
password-protected area but everything I have tried fails.

The navigate method fails with a url such as "http://
", I cannot get sendkeys to work either and using
formdata also seems to fail.

Can anyone provide a code snippett that opens page and hands over the
username and password?

Many thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Problem using internetexplorer object to open a url

On May 21, 3:44 pm, Duncan wrote:
I am trying to open a browser window from VBA and navigate to a
password-protected area but everything I have tried fails.

The navigate method fails with a url such as "http://
", I cannot get sendkeys to work either and using
formdata also seems to fail.

Can anyone provide a code snippett that opens page and hands over the
username and password?

Many thanks!


Hello Duncan,

I wrote this macro to logon to Gmail from Internet Explorer. Add your
email and password to code where indicated.

'----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'Written: January 17, 2008
'Author: Leith Ross
'Summary: Logs on to Gmail using Internat Explorer
'This code first requires setting a reference to Microsoft Internet
Controls.
'In the Object Browser the properties, methods, and events appear
under SHDocVw.

Sub LogOnToGmail()

Dim IEapp As Object
Dim Password As String
Dim UserName As String
Dim URL As String

URL = "https://www.google.com/accounts/ServiceLogin?
service=mail&passive=true&rm=false&continue=https% 3A%2F
%2Fmail.google.com%2Fmail%3Fnsr%3D1%26ui%3Dhtml%26 zy
%3Dl&ltmpl=default&ltmplcache=2&hl=en/"
UserName = "Your UserName" <----- Change
Password = "Your Password" <-----Change

Set IEapp = New InternetExplorer

' Launch Internet Explorer and go to the site
With IEapp
.Visible = True
.Navigate URL
End With

' Wait until Internet Explore finishes loading
While IEapp.Busy
DoEvents
Wend

' Inserts your Email name
IEapp.Document.all("Email").Value = UserName
' Wait till the page is loaded
While IEapp.Busy
DoEvents
Wend

' Inserts your password
IEapp.Document.all("passwd").Value = Password
' Wait till the page is loaded
While IEapp.Busy
DoEvents
Wend

' Clicks the Sign In button
IEapp.Document.all("signIn").Click
While IEapp.Busy
DoEvents 'wait until IE is done loading page.
Wend

End Sub
'----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sincerely,
Leith Ross
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Problem using internetexplorer object to open a url

Hi there!

This is great but it seems to work with a login where the username and
password fields are actually on a webpage. I need to log onto a
webpage using the password box that internet explorer pops up before
the page starts to load.

Very useful code though Leith, I can imagine I'll find a variety of
uses for it!

Best wishes,

Dunx
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
Problem using an object inside another object.. Michel S. Excel Programming 2 March 1st 07 09:59 PM
Object Is Object evaluation problem mickey Excel Programming 4 November 20th 06 05:40 PM
InternetExplorer Q.Rhodes Excel Programming 1 May 23rd 06 09:38 PM
SHDocVw.InternetExplorer Pslm1271 Excel Programming 3 August 24th 04 04:49 AM
VBA InternetExplorer ReadyState loop Jason livesay Excel Programming 0 February 20th 04 01:07 AM


All times are GMT +1. The time now is 08:06 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"