title: How to save multiple web pages as pdf files or screenshot using excel macro?
body: <p>I tried out the code below but its only saving the page's HTML content and ends up excluding most of the important content on the page. </p>
  
  <p>If anyone can help me on how to save these webpages as pdf or a png file it would be great.</p>
  
  <pre><code>Sub SaveWebpage()
      Dim objHTTP As Object, _
          objFSO As Object, _
          objFil As Object, _
          lngRow As Long, _
          strURL As String, _
          strPath As String, _
          strFilename As String
      Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      'On the next line change the file path as desired.  Make sure the path ends with \
      strPath = "C:\Users\Pradyumna\Desktop\Save Webpages"
      For lngRow = 2 To Application.ActiveSheet.UsedRange.Rows.Count
          strFilename = strPath &amp; lngRow &amp; ".htm"
          strURL = Application.ActiveSheet.Cells(lngRow, 1).Value
          objHTTP.Open "GET", strURL, False
          objHTTP.send ""
          Set objFil = objFSO.CreateTextFile(strFilename)
          objFil.Write objHTTP.responseText
          objFil.Close
      Next
      Set objHTTP = Nothing
      Set objFSO = Nothing
      Set objFil = Nothing
      MsgBox "All done!"
  End Sub
  </code></pre>