title: Excel VBA - list all VBA environmental variables
body: <p>How can I get excel to list me all available environmental variables on my "temp" sheet? Below code doesnt return anything for me...</p>
  
  <pre><code>Sub ListEnvironVariables()
      Dim strEnviron As String
      Dim i As Long
      For i = 1 To 255
          strEnviron = Environ(i)
          If LenB(strEnviron) = 0&amp; Then Exit For
          Debug.Print strEnviron
      Next
  End Sub
  </code></pre>
  
  <p>Thanks</p>