VBA ie unwanted redirecting

bubleeshaark

New Member
Joined
Jul 31, 2013
Messages
6
Hello Everybody (I've been using your forum for a while, but am just now posting)!!

Program: Excel 2007
Purpose: VBA to submit and extract insurance information from the web.
Problem: After navigating to a link, the webpage sometimes redirects.
Pertitent Details: Due to HIPPA I cannot post the webpage source. The problem occurs regardless of method: VBA or manual.

The issue occurs after this command:
Code:
            .Navigate2 "[URL]https://ohp.ros.regence.com/provider/wa-selfservice/protected/benefitSummaryCPSS.do?SELECTED_COVERAGE_LINE_PARAMETER_KEY[/URL]=" & viewcvrg

The webpage keeps "redirecting." I put that in quotes because the address doesn't change, only the entire HTML document is replaced with a single line:
Code:
2013

Attempted Solutions:
I tried .Navigate, .Navigate2, refreshing the page, and pressing the back button. Remember that this problem occurs even without VBA. It seems to be some timeout issue. Sometimes it occurs instantly and other times not for a few minutes. Thank you!
Adam

Code:
    ****** http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    ****** http-equiv="Content-Style-Type" content="text/css">
    ****** http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 <!-- start: MTM Meta tags -->
 ****** name="DCSext.member" content="REMOVED">
 ****** name="DCSext.oaid" content="REMOVED">
 ****** name="DCSext.ARGF" content="REMOVED">
 ****** name="DCSext.memberid" content="REMOVED">
 ****** name="DCSext.groupId" content="REMOVED">
 ****** name="DCSext.affiliate" content="REMOVED">
 ****** name="DCSext.sessionid" content="REMOVED.ros1">
 ****** name="DCSext.rospUserId" content="!REMOVED">
 ****** name="DCSext.branding" content="REMOVED">
 ****** name="DCSext.action" content="REMOVED">
 ****** name="DCS.dcsaut" content="REMOVED">
<!-- end: MTM Meta tags -->
 
  
 
 
    <LINK rel=stylesheet type=text/css href="../../css/MPSSStyleSheet.css">
 
    <LINK rel=stylesheet type=text/css href="../../css/divedStyleSheet.css">
    <LINK rel=stylesheet type=text/css href="../../css/claimtable.css">
 <LINK rel=stylesheet type=text/css href="../../css/jQuery-ui.css">
 <LINK rel=stylesheet type=text/css href="../../css/jquery.popupBox.css">
 <LINK rel=stylesheet type=text/css href="../../css/jquery.popupBox.white.css">
 
    ******** type="text/javascript" src="../../js/formValidations.js">*********>
 ******** type="text/javascript" src="../../js/collapsexpand_nocookie.js">*********>
 ******** type="text/javascript" src="../../js/popup.js">*********>
 ******** type="text/javascript" src="../../js/jquery-1.6.4.js">*********>
 ******** type="text/javascript" src="../../js/jquery-ui-1.8.14.custom.min.js">*********>
 ******** type="text/javascript" src="../../js/timeout.js">*********>
 ******** type="text/javascript" src="../../js/jquery.popupBox.js">*********>
 ******** type="text/javascript" src="../../js/jquery.marquee.js">*********>
 <!-- US32619 - Print Claims Detail -->
 ******** type="text/javascript" src="../../js/jquery.printPage.js">*********>
 ******** type="text/javascript" src="../../js/util.js">*********>
 
******** type="text/javascript" src="../../js/date_format.js">*********>
   <!-- If the JS below fails, at least the server time is shown -->
         

******** type="text/javascript"> 
   var now = new Date();
   var str = now.format("mm/dd/yyyy hh:MM TT (Z)");
   document.getElementById("timestamp").innerHTML = str;
*********>
             

******** src="../../js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" language="javascript">*********>
******** src="../../js/jquery.tooltip.js" type="text/javascript" language="javascript">*********>
******** src="../../js/jquery.popupBox.js" type="text/javascript" language="javascript">*********>
******** src="../../js/formValidations.js" type="text/javascript" language="javascript">*********>
 

    [B]Member info[/B]: REMOVED
   

   <!-- when collapsed, display member name, DOB, member ID and group name -->
   
    [B]Expanded member info[/B]
   

   <!-- begin: Member summary -->
   
     [TABLE="class: summaryTableMedium, width: 294"]
<TBODY>[TR]
[TH]Member
[/TH]
[TH][/TH]
[/TR]
[TR]
[TD="width: 110"]Member Name:
[/TD]
[TD="width: 110"]REMOVED
[/TD]
[/TR]
[TR]
[TD]Relationship:
[/TD]
[TD]REMOVED
[/TD]
[/TR]
[TR]
[TD]Gender:
[/TD]
[TD]REMOVED
[/TD]
[/TR]
[TR]
[TD]Member ID:
[/TD]
[TD]UDW
      REMOVED
[/TD]
[/TR]
[TR]
[TD]Date of Birth:
[/TD]
[TD]REMOVED
[/TD]
[/TR]
[TR]
[TD]Address:
[/TD]
[TD]REMOVED
[/TD]
[/TR]
[TR]
[TD]Group Number:
[/TD]
[TD]       REMOVED

[/TD]
[/TR]
[TR]
[TD]Group Name:
[/TD]
[TD]       REMOVED

[/TD]
[/TR]
[TR]
[TD="colspan: 2"]Network Information
[/TD]
[/TR]
[TR]
[TD]      Medical Network:
     
[/TD]
[TD]REMOVED
[/TD]
[/TR]
</TBODY>[/TABLE]

    <!-- end: Member summary --> <!-- begin: Payer and Primary Care summary -->
    <!-- don't display PCP table if no data --> 
     [TABLE="class: summaryTablexSmall"]
<TBODY>[TR]
[TH="colspan: 2"]Payer Info
[/TH]
[/TR]
[TR]
[TD]Primary Carrier Name:
[/TD]
[TD]REMOVED
[/TD]
[/TR]
[TR]
[TD]Carrier Effective Date:
[/TD]
[TD]REMOVED
[/TD]
[/TR]
[TR]
[TH="colspan: 2"]Elig/Pre Ex
[/TH]
[/TR]
[TR]
[TD]Pre Ex Credits:
[/TD]
[TD]REMOVED REMOVED
[/TD]
[/TR]
[TR]
[TD]Original Effective Date:
[/TD]
[TD]REMOVED
[/TD]
[/TR]
</TBODY>[/TABLE]
     
       
         [B]Related Members[/B]
            [TABLE="class: summaryTableWide"]
<TBODY>[TR]
[TD]          REMOVED
          
REMOVED
[/TD]
[TD="width: 67%"]              [URL="http://www.mrexcel.com/forum/benefitSummaryCPSS.do?SELECTED_COVERAGE_LINE_PARAMETER_KEY=0"]View Coverage[/URL] »
         
          
              [URL="http://www.mrexcel.com/forum/claimSummary.do?SELECTED_COVERAGE_LINE_PARAMETER_KEY=0"]Medical Claims[/URL] »
         
          
              [URL="http://www.mrexcel.com/forum/dentalClaimSummary.do?SELECTED_COVERAGE_LINE_PARAMETER_KEY=0"]Dental Claims[/URL] »
         
          
           

          
              [URL="http://www.mrexcel.com/forum/memberCost.do?SELECTED_COVERAGE_LINE_PARAMETER_KEY=0"]Cost Estimator[/URL] »
         
[/TD]
[/TR]
</TBODY>[/TABLE]

      
   
[LIST]
[*][URL="http://www.mrexcel.com/forum/#MedicalTab"]Medical Benefits[/URL]
[/LIST]
[TABLE="class: summaryTableWide"]
<TBODY>[TR]
[TD="class: planEmph"]REMOVED
[/TD]
[TD]Effective:
[/TD]
[TD="class: planEmph"]REMOVED
[/TD]
[/TR]
[TR]
[TD="class: planEmph"][/TD]
[TD]Status/End Date:
[/TD]
[TD="class: planEmph"]REMOVED
[/TD]
[/TR]
</TBODY>[/TABLE]

     

     
       [B]All information shown as of
       REMOVED[/B]


       
[LIST]
[*]Benefits
[*]Accumulators
[*]Booklets
[*]Multi-year Accumulators
[/LIST]

******** type="text/javascript">        
 $("#medMultiSearchForm").submit(function() {
  $("input#mmySubmit").attr('disabled', 'disabled');
  $("#mmyTable tbody").empty();
  $("#mmyTable thead").show();
  $.ajax({
   url: "coverageMMY.do",
   data: { asOfDate : "REMOVED",
     service : $("#medMultiSearchForm #medicalServices").val() },
   success: function(html) {
    $("#mmyContainer").empty();
    $("#mmyContainer").append(html);
    $("#mmyTable thead").hide();
    $("input#mmySubmit").removeAttr('disabled');
   },
   error: function(html) {
    $("input#mmySubmit").removeAttr('disabled');
   }
  });
  return false;
 });
*********>
         [TABLE="class: summaryTableWide"]
<TBODY>[TR]
[TD="colspan: 6"]Loading...
[/TD]
[/TR]
</TBODY>[/TABLE]

         

       

      

     
     

    

   
******** type="text/javascript"> 
$(document).ready(function() {
 $("div.covTab").hide();
 $("div.default").show();
});
*********>
   
   
<!-- AJAX dumps benefits/accums tables here -->


******** type="text/javascript"> 
$(document).ready(function(){
 $.ajax({
  url: "coverageBenefits.do",
  data: { asOfDate : "REMOVED"},
  success: function(html) {
   $("#benefitsContainer").append(html);
  },
  timeout: 45000,
  error: function() {
   $("div#MedicalBenefitsTab, div#DentalBenefitsTab").append(($(" 
")).addClass("summaryTableCont").css("height", "315px").append($("Benefits are temporarily unavailable.  Please retry your inquiry.").addClass("redBoldText")));
   $("div#MedicalAccumsTab, div#DentalAccumsTab").append(($(" 
")).addClass("summaryTableCont").css("height", "315px").append($("Accumulators are temporarily unavailable.  Please retry your inquiry.").addClass("redBoldText")));
   $("img#MedicalBenefitsSpinner, img#MedicalAccumsSpinner, img#DentalBenefitsSpinner, img#DentalAccumsSpinner").hide();
 
   $("li.Medical.Benefits").click(function() {
    var allTabs = $("li.Medical");
    $(this).siblings().removeClass("selected");
    $(this).addClass("selected");
    $(allTabs).each( function () {
     $("div" + $(this).children("a").attr("name")).hide();
    });
  
    var thisDiv = "div" + $(this).children("a").attr("name");
    $(thisDiv).show();
    
    if($.browser.msie)
    {
     var footerBottom = $("div#pageFooter").offset().top + $("div#pageFooter").outerHeight();
     $("body").css("height", footerBottom + "px;");
    }
    
    $('html, body').animate(
     { scrollTop: $(document).height() - $(window).height() },
     0, "easeOutQuint"
    );
    return false;
   });
   $("li.Dental.Benefits").click(function() {
    var allTabs = $("li.Dental");
    $(this).siblings().removeClass("selected");
    $(this).addClass("selected");
    $(allTabs).each( function () {
     $("div" + $(this).children("a").attr("name")).hide();
    });
  
    var thisDiv = "div" + $(this).children("a").attr("name");
    $(thisDiv).show();
    
    if($.browser.msie)
    {
     var footerBottom = $("div#pageFooter").offset().top + $("div#pageFooter").outerHeight();
     $("body").css("height", footerBottom + "px;");
    }
    
    $('html, body').animate(
     { scrollTop: $(document).height() - $(window).height() },
     0, "easeOutQuint"
    );
    return false;
   });
 
  }
 });
});
*********>      

  
******** type="text/javascript"> 
$(document).ready(function(){
 $.ajax({
  url: "coverageBooklets.do",
  data: { asOfDate : "REMOVED"},
  success: function(html) {
   $("#bookletsContainer").append(html);
  },
  timeout: 45000,
  error: function() {
   $("div#MedicalBookletsTab, div#DentalBookletsTab").append(($(" 
")).addClass("summaryTableCont").css("height", "315px").append($("Benefit booklets are temporarily unavailable.  Please retry your inquiry.").addClass("redBoldText")));
   $("img#MedicalBookletsSpinner, img#DentalBookletsSpinner").hide();
 
   $("li.Medical.Booklets").click(function(){
    var allTabs = $("li.Medical");
    $(this).siblings().removeClass("selected");
    $(this).addClass("selected");
    $(allTabs).each( function () {
     $("div" + $(this).children("a").attr("name")).hide();
    });
 
    var thisDiv = "div" + $(this).children("a").attr("name");
    $(thisDiv).show();
    
    if($.browser.msie)
    {
     var footerBottom = $("div#pageFooter").offset().top + $("div#pageFooter").outerHeight();
     $("body").css("height", footerBottom + "px;");
    }
    
    $('html, body').animate(
     { scrollTop: $(document).height() - $(window).height() },
     0, "easeOutQuint"
    );
    return false;
   });
   $("li.Dental.Booklets").click(function(){
    var allTabs = $("li.Dental");
    $(this).siblings().removeClass("selected");
    $(this).addClass("selected");
    $(allTabs).each( function () {
     $("div" + $(this).children("a").attr("name")).hide();
    });
 
    var thisDiv = "div" + $(this).children("a").attr("name");
    $(thisDiv).show();
    
    if($.browser.msie)
    {
     var footerBottom = $("div#pageFooter").offset().top + $("div#pageFooter").outerHeight();
     $("body").css("height", footerBottom + "px;");
    }
    
    $('html, body').animate(
     { scrollTop: $(document).height() - $(window).height() },
     0, "easeOutQuint"
    );
    return false;
   });
  }
 });
});
*********>      
  

 



 
******** type="text/javascript"> 
$(document).ready(jQ_******);
 
function jQ_******() {
 //  initialize datepicker
 $("#asOfDate").datepicker({
  showButtonPanel: true,
  defaultDate: "07/31/2013"});
 $("div.ui-datepicker").hide();
 
 $("div.addlFamily tr:odd").addClass("rowOdd");
 
 $("#asOfDate").change(onChangeDate);
 
 $('#memberHeaderShow').hide();
 $('#memberHeaderHide').show();
 $('#memberContent').slideDown();
 
 $('#memberHeaderShow').click(function() {
  $(this).hide();
  $('#memberHeaderHide').show();
  $('#memberContent').slideDown();
 });
 $('#memberHeaderHide').click(function() {
  $(this).hide();
  $('#memberHeaderShow').show();
  $("#memberContent").slideUp();
 });
 
 $("#tabs a:not(:first)").each( function () {
  $($(this).attr("href")).hide();
 });
 
 $("#tabs li").click(function () {
  var allTabs = $("#tabs li");
  $(this).siblings().removeClass("selected");
  $(this).addClass("selected");
  $(allTabs).each( function () {
   $($(this).children("a").attr("href")).hide();
  });
  var thisDiv = $(this).children("a").attr("href");
  $(thisDiv).show();
  return false;
 });
 
 $("table#eligTable tr:even").addClass("trEven");
 $("table#payerTable tr:even").addClass("trEven");
}
 
function onChangeDate()
{
 document.forms[0].submit();
}
*********>



 
   

 

 <!-- start: footer -->
 
 
 
  
     
       ©1996-******** type="text/javascript">document.write(new Date().getFullYear())*********> Regence BlueShield. All rights reserved. [URL="http://www.mrexcel.com/forum/privacyPolicy.do"]Privacy Policy[/URL] & [URL="http://www.mrexcel.com/forum/privacyPolicy.do"]Terms of Use[/URL].
Regence BlueShield serves much of the state of Washington and is an Independent Licensee of the Blue Cross and Blue Shield Association. This application is for information only and cannot be considered a commitment of payment. Data shown may change as member files are updated.
     

     
 
******** type="text/javascript"> 
var MTM_DOMAIN = "sdc.myregence.com";
var MTM_DCSID = "dcsx4dt1cptmmadx2fzsrsp7s_2b7m";
*********>
   ******** type="text/javascript" src="../../js/webtrends.js">*********>
 
 
 

 
 <!-- end: footer -->
 
  
   You are about to be logged out of Provider Center due to
  inactivity. Click 'Continue' to keep working or 'Logout'
  to logout.  If you take no action, you will be automatically
  logged out shortly.</P?>
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,318
Office Version
  1. 365
Platform
  1. Windows
Adam

Sounds like the page is redirecting by design.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,318
Office Version
  1. 365
Platform
  1. Windows
I'm not sure.

It might be possible to stop the redirect with the Stop method of IE.

I suppose the problem with that is having to detect the redirect.
 

bubleeshaark

New Member
Joined
Jul 31, 2013
Messages
6

ADVERTISEMENT

Great idea; I think I almost got it.

Code:
        For i = 3 To 4
            Do Until .readyState = i
                b = ie.document.body.innertext
                If b = "2013" Then
                    .GoBack
                    .Application.Wait ("00:00:01")
                    .stop
                End If
            Loop
        Next i

Is the .Stop not working?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,318
Office Version
  1. 365
Platform
  1. Windows
There seems to be a with statement missing, what is .stop referring back to?

Also, I doubt the entire innertext of the body of the document will equal "2013".

I was thinking more of some sort of event via a class that could monitor IE and check for a redirect.

If a redirect is detected then use Stop.
 

bubleeshaark

New Member
Joined
Jul 31, 2013
Messages
6
Sorry, I shouldn't have assumed the with:

Code:
Function waitie(ie)
    On Error Resume Next
    Dim b As String
    With ie
        For i = 3 To 4
            Do Until .readyState = i
                b = ie.document.body.innertext
                If b = "2013" Then
                    .GoBack
                    .Application.Wait ("00:00:01")
                    .stop
                End If
            Loop
        Next i
    End With
    waitie = ""
End Function

The entire webpage really does equal "2013". (Rightclick - View Source - I would post the source but it's just
Code:
2013
, and literally nothing else. I put a pause on .GoBack and it works.

What you're talking about sounds more useful, yet fancy. I have never written a class before (no programming background: self-taught VBA and VB Reflection = extinct language), so I wouldn't even know where to start on that.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,318
Office Version
  1. 365
Platform
  1. Windows
I've got code, somwhere, that will monitor IE to see if a new window is opened from a page.

That's useful when dealing with a page that has popups for further input, eg a calendar pop-up.

That kind of relies on knowing what to look for, which in turn relies knowing the source/URL etc of the page.

If what you have works then it might be best to stick with it
 

Forum statistics

Threads
1,148,146
Messages
5,745,053
Members
423,917
Latest member
Frank1931

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
Top