title: Will Excel VBA interact with web page generated with PHP?
body: <p>7/18/14
  Okay -- most recent discovery. For some reason the code works on the server side page when the code is run on a computer with a different version of IE (IE 10 vs IE 8), so I would logically conclude that it's a compatibility issue with the new IE version, right? Or is that wrong? If it is, is there any known remedy to that?</p>
  
  <hr>
  
  <p>7/14/18
  I've been looking for an answer for this for a couple days now, and I can't seem to find precisely what I'm looking for...</p>
  
  <p>I'm working on a project that involves uploading specific columns of data from a report to a central location on the web to allow relevant data to be updated more efficiently and to provide an environment where the data wouldn't be corrupted as easily (there's over a hundred people that touch this report, and as we all know, mistakes happen...). At any rate, I made a front end page using html and javascript with a basic form at the top where an Excel Macro would enter data and submit it to the page, populating a table in the page body with each additional row of data. This prototype was working like a charm. </p>
  
  <p>Then we actually uploaded the code onto a server on a PHP page to allow it to be able to store the added rows in a database/save changes as they were made. Only problem, now the VBA will not interact with the page. I've tried several different things that got me error messages like "does not support property or method", "type mismatch", "server doesn't exist"... I know you can use GET and POST methods with VBA, which is probably what we'll have to do, but for future reference, is there any way to allow VBA to interact with html tags generated by PHP?</p>
  
  <p>I'll include my code below and make notes as to where it was breaking for those of you who are curious:</p>
  
  <pre><code>Sub data_push()
  
  Dim curRow
  curRow = 2
  
  Set objIE = CreateObject("InternetExplorer.Application")
  
  With objIE
      .Visible = True  
      .navigate "towebsite"
      Do While .Busy Or .readystate &lt;&gt; 4
          DoEvents
      Loop
  End With
  
  Dim Shell As Object
  Dim IE As Object
  
  Set Shell = CreateObject("shell.application")
  
  For Each IE In Shell.Windows
  
      If IE.LocationURL = "towebsite" Then
          Sheets("All Data").Activate
          With IE
  
          Set addRow = .document.getElementsByTagName("a")
              '.Visible = False
          Do While Not IsEmpty(Sheets("All Data").Cells(curRow, 2))
              Set dataID = .document.getElementById("data-id")
              dataID.Value = Sheets("All Data").Cells(curRow, 2)
              '...do stuff       
  
              curRow=curRow+1        
          Loop
  
          End With
  
      End If
  Next
  End Sub    
  </code></pre>
  
  <p>If I am seeing my problem correctly, the code is breaking at "Set addRow = .document..."
  Pretty sure the main problem is something akin to a 'type mismatch' (i.e. html vs php), but if that is the case I have no idea how to work around it...</p>
  
  <p>Thanks for your help in advance!</p>
  
  <hr>
  
  <p>HTML:</p>
  
  <pre><code>&lt;doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"&gt;
  &lt;script src="http://code.jquery.com/jquery-1.11.1.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/Javascript"&gt;
  &lt;/script&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div class="container"&gt;
  
      &lt;table class="table" id="myTable"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;somethinggoeshere&lt;/th&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
  
                  &lt;form&gt;
                      &lt;th&gt;&lt;input name = "id" class="text data-id" id="data-id"&gt;&lt;/th&gt;
  
                  &lt;/form&gt;
                  &lt;th&gt;&lt;a href="#" class="btn btn-primary row-add"&gt;Add Row&lt;/a&gt; &lt;/th&gt;
                  &lt;th class="dateTag"&gt;&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt; 
  
          &lt;/tbody&gt;
      &lt;/table&gt;
  
  &lt;/div&gt;
  ...
  </code></pre>