IE Automation - Stop clicking sound! How2Add Timer

Kreiz

New Member
Joined
May 6, 2011
Messages
38
Hello,

After summer of learning excel and VBA I feel like a pseudo guru with macros, TY much to all the boards!

I have a macro that logs into my work site and runs through thousands of rows of customer &/or carrier pages, only thing it is making the click sound when the online form is submitted. It would be fine if only once or twice now and then but this macro runs all the time and I am tired of hearing this CLICK sound when it runs.

I have tried .audible .sound .noise .stopannoyingfu64sound -ok the last wast on a humbug

this one goes to however many pages in column A but when it submits the form and clear or start over it clicks...this is annoying because it will go through many pages in a minute = LOTS OF CLICKING SOUND...and IE is not visible.

Code:
Dim ieDoc As Object
Dim ieEle As Object
Set ie = CreateObject("InternetExplorer.Application")
        ieDoc.all.UserName.Value = "haha"
        ieDoc.all.Password.Value = "hehe"
         ieDoc.forms(1).submit  'its the second form
        Do Until .ReadyState = 4: DoEvents: Loop
         Do While .Busy: DoEvents: Loop

    With ie
        .Visible = False
        '.audible = False
        .Navigate url
        Do Until .ReadyState = 4: DoEvents: Loop
        Set ieDoc = ie.Document
      k = 2      
       laneID = Range("a" & k)
       oZip = Range("e" & k)
       dZip = Range("h" & k)
       puDate = Range("p" & k)
      While laneID <> ""
      lastrow = ActiveSheet.UsedRange.Rows.Count
      Application.StatusBar = "    " & k - 1 & " of " & lastrow - 1 & "   " & oZip & "  -  " & dZip
      If k Mod 500 = 0 Then
            ThisWorkbook.Save
        End If
        On Error Resume Next
        
       If k Mod 500 = 0 Then
            ThisWorkbook.Save
        End If
       ieDoc.all.originZipCode.Value = oZip
        ieDoc.all.destinationZipCode.Value = dZip
        ieDoc.all.pickupdate.Value = puDate
          ieDoc.all.selectedTimeOfDay.Value = 4
          ieDoc.forms(2).submit
          Do Until .ReadyState = 4: DoEvents: Loop
          Do While .Busy: DoEvents: Loop
 'scrape
Set s = ie.Document.getelementsbytagname("TD").Item(73)
   txt = s.getAttribute("innertext")
       Worksheets("wkst").Range("m" & k).Value = txt
Set s = ie.Document.getelementsbytagname("TD").Item(74)
   txt = s.getAttribute("innertext")
       Worksheets("wkst").Range("n" & k).Value = txt
Set s = ie.Document.getelementsbytagname("TD").Item(75)
   txt = s.getAttribute("innertext")
       Worksheets("wkst").Range("o" & k).Value = txt
Set s = ie.Document.getelementsbytagname("TD").Item(76)
   txt = s.getAttribute("innertext")
       Worksheets("wkst").Range("q" & k).Value = txt
'Reset for Next load
Set ObjCollection = ie.Document.getelementsbytagname("input")
  I = 0
  While I < ObjCollection.Length
     If ObjCollection(I).Value = "Start Over" Then
           Set ObjElement = ObjCollection(I)
            Else
     If ObjCollection(I).Value = "Clear" Then
           Set ObjElement = ObjCollection(I)
            End If
            End If
     I = I + 1
     Wend
       ObjElement.Click
        Do Until .ReadyState = 4: DoEvents: Loop
          Do While .Busy: DoEvents: Loop
  
k = k + 1
 laneID = Range("a" & k)
 oZip = Range("e" & k)
 dZip = Range("h" & k)
Wend
Application.StatusBar = ""

         ie.Quit


Ooo would also like a timer to see how fast it has processed so many rows of data if you know of how.
:biggrin:
Any ideas are much appreciated, I have been scouring here and Google.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Possibly for future applications but what I am looking for is to mute the un-visible internet explorer browser. Still want to hear my movie or music on my PC as it is hooked to by big screen. Just the internet explorer application, that the macro is using, sound capability.
 
Upvote 0
You can change the sound settings for navigating in Sounds and Audio in Control Panel.

I thinks it's actually under Windows Explorer.

By the way, why are you using getAttribute?

You could just directly refer to the innertext property of the TD elements.
Code:
Set s = ie.Document.getelementsbytagname("TD").Item(73)

txt = s.innertext

Worksheets("wkst").Range("M" & k).Value = txt
 
Upvote 0
Re: IE Automation - 5k Form results being stopped by 1 Lil' popup box!

Much appreciated Norie!

Now here's a zinger..... Similar macro to run through many pages, but i cannot get the form to fully complete due to a little popup blip that occasionally will need to be clicked depending on the entry. Some of the Zip's will populate the city-state field but for my purposes it does not matter what their system ends up populating. This is a real speed-bump to move forward :-/



Here is the code for the top row in the above picture. Just need to select any of the options in the popup display after the macro enters the zip.

HTML:
<ul class="FormList">

                    <li>

                        <span id="ctl00_ctl00_mainContent_mainContent_lblSpan" class="swplabel"> </span>

                        <span id="ctl00_ctl00_mainContent_mainContent_lblZip" class="BoldLabel" style="display:inline-block;width:45px;">Zip</span>

                        <span id="ctl00_ctl00_mainContent_mainContent_lblCity" class="BoldLabel" style="display:inline-block;width:105px;">City</span>

                        <span id="ctl00_ctl00_mainContent_mainContent_lblState" class="BoldLabel" style="display:inline-block;width:30px;">St</span>

                        <span id="ctl00_ctl00_mainContent_mainContent_lblCountry" class="BoldLabel" style="display:inline-block;width:50px;">Country</span>

            

                        <div id="ctl00_ctl00_mainContent_mainContent_pnlOrig">

		

                            <span id="ctl00_ctl00_mainContent_mainContent_lblOrigZip" class="swplabel">From:</span>

                            <span id="ctl00_ctl00_mainContent_mainContent_txtOrigZip" style="display:inline-block;"><input name="ctl00$ctl00$mainContent$mainContent$txtOrigZip_box" type="text" maxlength="10" id="ctl00_ctl00_mainContent_mainContent_txtOrigZip_box" class="textBox textBoxRequired" autocomplete="off" style="width:40px;" /></span>

                            <span id="ctl00_ctl00_mainContent_mainContent_txtOrigCity" tabindex="1" style="display:inline-block;"><input name="ctl00$ctl00$mainContent$mainContent$txtOrigCity_box" type="text" maxlength="20" id="ctl00_ctl00_mainContent_mainContent_txtOrigCity_box" class="textBox city-state textBoxRequired" autocomplete="off" style="width:100px;" /></span>

                            <span id="ctl00_ctl00_mainContent_mainContent_txtOrigState" tabindex="2" style="display:inline-block;"><input name="ctl00$ctl00$mainContent$mainContent$txtOrigState_box" type="text" id="ctl00_ctl00_mainContent_mainContent_txtOrigState_box" class="textBox city-state textBoxRequired" autocomplete="off" style="width:25px;" /></span>

                            <span id="ctl00_ctl00_mainContent_mainContent_cmbOrigCountry" tabindex="3" style="display:inline-block;"><select name="ctl00$ctl00$mainContent$mainContent$cmbOrigCountry_lst" id="ctl00_ctl00_mainContent_mainContent_cmbOrigCountry_lst" class="dropDownList" style="width:45px;">

			<option selected="selected" value="NULL"></option>

			<option value="CA">CA</option>

			<option value="MX">MX</option>

			<option value="US">US</option>



		</select></span>

                            

                        

	</div>
 
Upvote 0
Re: IE Automation - 5k Form results being stopped by 1 Lil' popup box!

Under what circumstances does the popup appear?

Is it to confirm something?

Or to pick location if an 'ambigous' zip code or other data have been entered?

I know that last one is unlikely with a zip code but I've seen it happen.

The code helps a bit but without seeing it in context it doesn't mean much.

If I'm right this an ASP, or other server type page, which means a lot of what happens is going on in the background - if that makes sense.:)
 
Upvote 0
A bit of that makes sense, the popup will populate whenever you leave the zip text box with a value in it that it needs you to narrow down the city/state selection. A large amount of the zip codes I have will automatically pull a city state value without needing user input, but yet a good bit do require this user input. I have written in my script for .value = 00000 then .select on the text box so it will give the server the perception the box was changed.
 
Upvote 0
So is it the popup in the image?

Or do you see that after the popup?
 
Upvote 0
The little box that has the W Hatfield row and West Hatfield row is the popup that is stopping me.
 
Upvote 0
What is it exactly?

A message box, a small form?
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top