+ Reply to Thread
Results 1 to 12 of 12

VBA Macro to Internet Explorer automation

  1. #1
    Registered User
    Join Date
    04-17-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    7

    Post VBA Macro to Internet Explorer automation

    Greetings to all experts and gurus out there!
    I’m trying to automate my excel to click on specific fields and login to a specific site currently I’m using sendkeys, but you know how unreliable the code is. I’m not entirely sure that the <td> and <div> is the cause, but this is the only difference I see from the sites where my code is working and is not working. Please see the code below:
    P.S. got the code from Youtube, and I just modified it for my use. Props to the author!
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA Macro to Internet Explorer automation

    Hello darkstarpepper,

    This worked for me. Change the variables "user" and "pwd" to your user name and password.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    04-17-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA Macro to Internet Explorer automation

    thank you so much for the rep! I'll update you on this one if it works. Thanks!

    Moments later..

    I've tried your code.. unfortunately I'm getting a:

    runtime-error'91':
    Object variable or with block variable not set

    it then highlights the following on the code

    oUser.Value = user

    Note:
    I've already changed the user and pwd fields with my username and password..
    Last edited by Leith Ross; 04-05-2015 at 01:57 PM. Reason: after testig

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA Macro to Internet Explorer automation

    Hello

    This should fix the problem...
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-17-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA Macro to Internet Explorer automation

    Worked like a charm Leith! Thank you so much for this.. I have a ton of internal sites waiting to be automated! is it fine if I ask some follow up questions if incase some of the internal sites won't accept the code? (its just me thinking ahead due to excitement!) anyways. Mission accomplished on this one! thanks a lot!

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA Macro to Internet Explorer automation

    Hello darkstarpepper,

    You're welcome. Of course you can ask followup questions.
    Last edited by Leith Ross; 04-05-2015 at 06:31 PM.

  7. #7
    Registered User
    Join Date
    04-17-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA Macro to Internet Explorer automation

    So sorry for a quick followup question. Upon testing the code at home, i was able to run it.. now im trying to run it here at the office and it's giving me a runtime error. Please see error code below


    Run-time error '-2147417848(80010108)':

    Automation Error
    The object invoked has disconnected from its clients

    it then highlights the following line:

    Set HTMLDoc = IE.document
    Last edited by darkstarpepper; 04-06-2015 at 07:41 AM. Reason: upon trying to fix the issue i got a new error msg

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Macro to Internet Explorer automation

    Hi Leith and dark,
    I saw a typo on the variable name, but did not inform Leith.

    Please Login or Register  to view this content.
    is not the same variable name as

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-17-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA Macro to Internet Explorer automation

    Wierd, but i was able to make it work at home.. Will keep you posted after testing it out.. thanks AB33

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA Macro to Internet Explorer automation

    Hello AS33,

    Thanks for the catch!

    @ darkstarpepper - The error means that the HTML document no longer refers to the Internet Explorer document. This generally happens when Internet Explorer has not finished processing the document before the system returns control to VBA.

    Internet Explorer runs in parallel with the VBA code. There is no way to synchronize the two 100 percent The best method is to catch the run-time error and flag the URL that failed and then have the program go back later and recheck those that failed the first time.

  11. #11
    Registered User
    Join Date
    04-17-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA Macro to Internet Explorer automation

    gotcha on that one Leith. I know I was able to make it work at home, but unfrotunately its not letting me here @ work will try to work it out on my own for the moment.. Il keep you guys posted. Thanks for the asssist guys!

  12. #12
    Registered User
    Join Date
    04-17-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA Macro to Internet Explorer automation

    sorry guys for the late update.. tried it out at my house and it worked, then tried it out again at work then its not working.. i am not entirely sure what the issue is, it might be something with the restrictions or whatever imposed by our system admin.. Ill try to get a fix on this one and post the code once i get this done. Thanks for the help again Leith and AB33

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Internet Explorer Automation
    By jagguvaka in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-22-2013, 04:35 AM
  2. Internet Explorer Macro Automation
    By kboy1289 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-15-2013, 03:48 PM
  3. VBA Internet Explorer Automation using frames
    By kboy1289 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-16-2012, 04:43 PM
  4. Internet explorer download automation
    By exc4libur in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-28-2012, 05:23 PM
  5. Very Few Posts regarding Internet Explorer Automation
    By Lisa4legin in forum Excel General
    Replies: 3
    Last Post: 05-09-2012, 02:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1