Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
April 2017
MonTueWedThuFriSatSun
     12
3456789
10111213141516
17181920212223
24252627282930

Calendar Calendar


Automatically login to Gmail from excel using VBA

View previous topic View next topic Go down

Automatically login to Gmail from excel using VBA

Post by ranjithkumar8352 on Thu May 15, 2014 5:53 am

Hello everyone,

I would like to share a topic which has been a question mark for many excel users - how to login to gmail automatically from excel using VBA and the solution is here..

This VBA code is used to login to gmail from Internet explorer.

In my next post i will be posting how to use chrome or firefox for this and it requires installation of a small software, The reason behind why software is to be installed for chrome & firefox and not required for Internet explorer is - IE and Excel are microsoft softwares and so they have inbuilt controls to each other and contrary in case of firefox and chrome.

Here is the VBA code i used

Code:
Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
 Sub AutoLogin()
 Dim MyHTML_Element As IHTMLElement
 Dim MyURL As String
 On Error GoTo Err_Clear
 MyURL = "http://gmail.com"
 Set MyBrowser = New InternetExplorer
 MyBrowser.Silent = True
 MyBrowser.navigate MyURL
 MyBrowser.Visible = True
 Do
 Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
 Set HTMLDoc = MyBrowser.document
 HTMLDoc.all.Email.Value = Sheets(1).Range("B9").Value
 HTMLDoc.all.Passwd.Value = Sheets(1).Range("B11").Value
 For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
 If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
 Next
Err_Clear:
 If Err <> 0 Then
 Err.Clear
 Resume Next
 End If
 End Sub
Note : B9 and B11 are the cells in which Email and password are entered

We can alter this code to make automation to other sites, Please check the attached file for more info.

Regards,
Ranjith
Attachments
Automatic login to gmail.xlsm (70 Kb) Downloaded 125 times
avatar
ranjithkumar8352

Posts : 5
Join date : 2014-05-14

View user profile

Back to top Go down

Thanks a lot

Post by David_cool on Thu May 15, 2014 11:05 am

Thanks a lot ranjith, I've been searching for this   bounce  Thank you and waiting to see how it works in chrome  cheers

David_cool
Guest


Back to top Go down

Re: Automatically login to Gmail from excel using VBA

Post by ranjithkumar8352 on Thu May 15, 2014 4:45 pm

David_cool wrote:Thanks a lot ranjith, I've been searching for this   bounce  Thank you and waiting to see how it works in chrome  cheers

With pleasure David  Smile
avatar
ranjithkumar8352

Posts : 5
Join date : 2014-05-14

View user profile

Back to top Go down

Re: Automatically login to Gmail from excel using VBA

Post by shyam chegu on Sat May 17, 2014 11:18 am

Thanks ranjith,
this is useful for me....
please come out with more of this kind..

shyam chegu

Posts : 1
Join date : 2014-05-17

View user profile

Back to top Go down

Re: Automatically login to Gmail from excel using VBA

Post by ranjithkumar8352 on Sun May 18, 2014 1:41 pm

shyam chegu wrote:Thanks ranjith,
this is useful for me....
please come out with more of this kind..

With pleasure shyam Smile
avatar
ranjithkumar8352

Posts : 5
Join date : 2014-05-14

View user profile

Back to top Go down

Re: Automatically login to Gmail from excel using VBA

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum