html - Select Internet window from vba -


i doing macro on vba accessing webpage, providing username , password , when click on "login" button new page open in new window. have 2 distinct webpages active 1 not 1 want anymore. struggling activating new window. also, impossible access directly new window without passing gfirst main 1 though has unique link. thought different ways, never make !

1 ) use "shell" count different windows open , if 1 of them has link of window want activate, set internet one. issues method :

    if my_shell.windows(0).document.location = "https://mywebsite"        msgbox "0"        set ie = my_shell.windows(0)        goto laa     elseif my_shell.windows(1).document.location = "https://mywebsite"         msgbox "1"         set ie = my_shell.windows(1)         goto laa     elseif my_shell.windows(2).document.location = "https://mywebsite"          msgbox "2"          set ie = my_shell.windows(2)          goto laa 

etc... big enough number of windows, of course code disgusting work with.

  1. i can find window i'm interested in still don't know how tell use active one
  2. i tried use loop go through opened object of shell didn't work reasons :

    sub shell_method() dim my_shell object dim object_count integer dim x integer dim path string dim ie object dim apparition integer apparition = 0 ' number of time aimed window opened set my_shell = createobject("shell.application") object_count = my_shell.windows.count msgbox object_count 'number of internet windows (visible or not) = 0 (object_count - 1) path = my_shell.windows(i).document.location if path = "https://mywebsite" set ie = my_shell.windows(i) apparition = apparition + 1 exit else end if next end sub

    2) thought not showing window (visible = false) automatically activate inly visible 1 or @ least activate 1 of visible ones default...which realize wrong after hour of trying access html code of page thought activated. thoght try quit activate page again since know "navigate" command couldn't set page want since start process again unwanted page. if there command select given path instead of navigating it easier since window open. i'm bit lost , hope can me out , fix maximum of mistakes did far.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -