title: Run Excel VBA code using PHP
body: <p>I created Excel VBA code to create images from the corresponding URLs.</p>
  
  <p>How can I write this code while creating the Excel file using PHP?</p>
  
  <pre><code>Sub RetrieveImage()
  
      Dim url_column As Range
      Dim image_column As Range
  
      Set url_column = Worksheets(1).UsedRange.Columns("D")
      Set image_column = Worksheets(1).UsedRange.Columns("J")
  
      Dim i As Long
      For i = 2 To url_column.Cells.Count
  
        With image_column.Worksheet.Pictures.Insert(url_column.Cells(i).Value)
          .Left = image_column.Cells(i).Left
          .Top = image_column.Cells(i).Top
          image_column.Cells(i).EntireRow.RowHeight = .Height
        End With
  
      Next
  
  End Sub
  </code></pre>