This is my first post here so hello everybody!
I'm working on macro that opens html site using Internet Explorer. What it does is also fulfilling form on that site. There are 2 problems i can't solve on my own:
1)in that html form there is a text input field called "Name-input". I use this code to fill it with my name:
and it keep returning compile error. I think it's because of keyword "input" in the form field name. My code works like a charm for any other field but this one. I'm not able to change that field name in html form, so i need to change my macro.ie.document.forms(i).Name-input.Value = ""
2)Similliar situation. I want to save an image from site to my local drive. The obvious way would be to download it by its link, but it's not an option for me. I need to save it from site that's already beed loaded. I found solution on other forum, to use 2 functions - getElementByTagName and inStr. This is my code:
I know it works because it helped one guy that had same problem. I don't know what getElementByTagName actually returns and how to save it as an image.For Each ele In ie.document.getelementsbytagname("img") If InStr(ele.innerhtml, "alt=""linx""") > 0 Then Exit For Next ele
I will be very grateful for any suggestions...
Hello Robs23,
Welcome to the Forum!
There are several types of HTML Inputs: Button, Checkbox, Radio, Submit, Text, and few others. The HTML like this:
<input type="submit">
However, this doesn't help identify a particular element. Elements are most commonly identified using the id property or className property. While these properties are used often, they are unfortunately not a mandatory requirement for coding.
If these properties are absent, all is not lost. The element may contain unique text that distinguishes it from elements of the same type. The Element's text, if present, can be retrieved using the innerHTML property.
The last resort is to use surrounding elements as sign posts to the element you want. Maybe the element follows a particular div tag or anchor a.
If you post the page source or the URL then I could help you further.
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 Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Thank You for answer! But I think I didn't make myself clear. My problem is not finding any piece of html code. It's well signed. That element I have problem with is a text field withid=Name-input. I can't fulfill this particular text field because of its id, that contains VB keyword "input" within. While trying to compile it Excel goes crazy because it recognize "input" and expects () brackets after it. But in my code there should not be brackets because "input" is just a part of text field id....
if Your answer addressed also to 2) of my question, I'll try to explain: I want to save picture that already has been loaded with internet explorer. How to achieve that? I can't reload it anyhow because it changes everytime You reload the page. That function in my previous post was to find the proper html for this picture and keeps it in object. How to save it? This is the question...
Many Regards...
Thank You for effort but I don't know how it is to help me. I don't know if my english is that bad or what, but You seem not to understand the point of my post. I can't make myself clearer so I'll put my code for 1)
It doesn't work because of "-" between "name" and "input". If I replace it with "_" it works but I can't do it.Sub Login() Dim ie As Object Set ie = CreateObject("InternetExplorer.Application") Dim a As String With ie .Visible = True .navigate "http://www.somehtml" Do While .busy: DoEvents: Loop Do While .ReadyState <> 4: DoEvents: Loop With .document.Forms(i) 'Stree Number .login.Value = "wojtek@yahoo.com" 'Stree Name .Password.Value = "1234" .name-input.Value = "" End With End With End Sub
Regards
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks