dcsimg
Results 1 to 6 of 6

Thread: [RESOLVED] Gettting tab names in IE11

  1. #1

    Thread Starter
    Hyperactive Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    267

    Resolved [RESOLVED] Gettting tab names in IE11

    With the help of the API functions SendMessage, GetWndowLib, and GetClassName I can get the tab name of a specific IE 11 tab, if it is active. But if the tab I need is not active, how do I get it. How do I tell if the tab is not there at all.

    Thanks

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,864

    Re: Gettting tab names in IE11

    you can test if this works for you
    Code:
    Set sh = CreateObject("shell.application")
    For Each w In sh.Windows
        If w.Name = "Internet Explorer" Then Debug.Print w.document.Title
    Next
    tested on W10
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Hyperactive Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    267

    Re: Gettting tab names in IE11

    Thanks. This works just great.

    A couple add on questions.

    1. Intellisence does not work for sh or w. I don't understand why.
    2. I always use option explicit. What should I Dim sh and w as? Would this correct the intellisence?

    Thanks

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Gettting tab names in IE11

    Just a guess but I think it's because there isn't any .tlb for this. Could be something else altogether. You can Dim them as Variant (which is what they are by default) or as Object and no, this won't give you intellisence


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  5. #5

    Thread Starter
    Hyperactive Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    267

    Re: Gettting tab names in IE11

    Thanks to all. Thread will be marked resolved.

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,864

    Re: [RESOLVED] Gettting tab names in IE11

    you can dim sh and w as objects
    or
    if you add a reference to shell controls, and automation
    then dim sh as shell, intellisense will then partly work, but as w may be different objects depending on the type of the shell window, it will need to remain as object (or variant containing object),

    intellisense is partly broken in IE11 anyway as only dimensioned html objects show any variables or properties in the locals window (earlier versions of ie would show all the properties in the local windows, by drilling down from the window object)
    to see the properties of the document in the shell window you would need a reference to html object library, then set the window document to that
    Code:
    dim d as HTMLdocument
    set d = w.document
    intellisense should then work with the document as well

    edit: it would appear that the shell window is always a webbrowser2 object, so could be dimensioned as such
    Last edited by westconn1; Jun 12th, 2016 at 06:16 PM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width