Excel VBA getElementsByTagName() only returning the last input -
My company will require more than 1000 people to reset the username and password, and instead it is emanually To do this, I want to do VBA to automate it for me. I have the IE window connected properly, but getElementsByTagName ("Input") only gives the final input tag below. My code is:
Dim shellWins ShellWindows as slow IE InternetExplorer dim htmldoc HTMLDocument as slow objElement As Object Dim objCollection as IHTMLElementCollection retarded name string as dim Val string, val2 string dim Selvans as the Selvins = new Selvevando as if a set. Account & gt; Then go to IE = Set IE = shellWins.Item (0) or else 'IE set IE = Create new InternetExplorer IE.Visible = true end then set objCollection = IE.Document.getElementsByTagName ("Input") for I = 0 objCollection for. Length name = objCollection (i) .name then left (name, 6) = user name then val = objCollection (i) .value a = split (val, "@") if left (a (1), 1) Lt; & Gt; "S" then val2 = a (0) & amp; Sa & amp; A (1) otherwise Val2 = Val end then objCollection (i) .Value = val2 elseif Left (name, 6) = pswd again objCollection (i) .value = npsswd end then next set shellWins = nothing set IE = anything
The input tags I want are in the table tag, can it be? If so, how do I reference the tag inside the table?
Thank you in advance.
instead try this loop:
Set objCollection = IE.document.getElementsByTagName ("Input") in the objCollection for each L then left (el.Name, 6) = 'Username' then? "User name"? A = Split (L. Value, "@") if left (A, 1) & lt; & Gt; "S" then val2 = a (0) & amp; Sa & amp; A (1) el.Value = val2 end if left or else (el.Name, 6) = pswd then el.Value = nPswd termination if next L
though not sure: you It seems that some codes have been omitted from your question.
Comments
Post a Comment