Results 1 to 3 of 3
  1. #1
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480

    Exclamation IE element in disabled state

    So here's a story.... of a lovely lady.....

    Okay so I am using VBA to automate a webpage and everything over all is running smoothly.. however, there are a couple elements that are disabled in the html... causing a delay, and many headaches.

    This is the the html element I am trying to run code against...
    Code:
    <input name="FullName" disabled="disabled" class="tTextBox" id="FullName" onblur="checkName(this.value,event)" type="text" size="30"/>

    And here is the code that I am trying to put against it.
    Code:
    oIE.Document.Frames(1).Document.all.Item("FullName").Value = "Lastname, Firstname"
    So if the textbox is in the disabled state, I cannot make any changes to it... So I have the code doing this in the error handler...
    Code:
    If Err.Number = 438 And Check = True ThenDebug.Print Cnt & " " & Err.Number & " " & Err.Description & " " & Erl
    Cnt = Cnt + 1
    If Cnt > 6000 Then End
    Resume
    Else
    Debug.Print Cnt & " " & Err.Number & " " & Err.Description & " " & Erl
    End If
    So when I hit these elements that are disabled, I know how many times the code is attempting to enter a value... it is usually anywhere between 600-1500 attempts..

    Eventually the element's html is updated and looks like this,
    Code:
    <input name="FullName" class="tTextBox" id="FullName" onblur="checkName(this.value,event)" type="text" size="30" value="Lastname, Firstname"/>
    And the code will change the value or do whatever we need with it..



    So the question is....
    Has anyone here had to change an IE element from disabled to not? How can it be done? I've tried things like...

    oIE.Document.Frames(1).Document.getElementById("Fu llname").disabled = Null
    oIE.Document.Frames(1).Document.getElementById("Fu llname").disabled = false
    oIE.Document.Frames(1).Document.getElementById("Fu llname").disabled = "false"

    All of these go thru, don't raise in errors.. but are not actually changing the element status.



    Any ideas?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    According to the internet, the disabled property is a Boolean. I would suspect false within quotes would be the answer.

    Have you tried declaring and instantiating an input box object and then changing its property?

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Code:
    Dim strAddress As String
    Dim oIE As InternetExplorer
    Dim HTMLdoc As HTMLDocument
    Dim oInput As HTMLInputElement
    
    strAddress = "C:\Test\HTML_Sample.htm"
    
    Set oIE = CreateObject("InternetExplorer.Application")
    oIE.navigate strAddress
    oIE.Visible = True
    
    While oIE.ReadyState <> 4 Or oIE.Busy = True: Wend
    
    Set HTMLdoc = oIE.Document
    Set oInput = HTMLdoc.all.Item("Fullname")
    
    oInput.disabled = False

Please reply to this thread with any new information or opinions.

Similar Threads

  1. State Reports - Help
    By TroxlSha in forum Reports
    Replies: 16
    Last Post: 10-29-2013, 07:34 AM
  2. VBA SharePoint manipulation, TextArea element issue
    By rnodern in forum Programming
    Replies: 1
    Last Post: 10-19-2013, 05:58 PM
  3. Placed in a State
    By lrobbo314 in forum Access
    Replies: 3
    Last Post: 04-07-2012, 11:26 AM
  4. Replies: 2
    Last Post: 08-18-2010, 02:09 PM
  5. Pause state?
    By Zermoth in forum Programming
    Replies: 1
    Last Post: 12-15-2008, 05:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums