title: VBS scripting to create a hotlink to external website in Excel
body: <p>We have a routine that creates a file to be run using VisualBasic that then creates an Excel spreadsheet. The method is relatively simplistic, but I have run into an issue trying to create a clickable URL to an external website. Here's a snippet of the code:</p>
  
  <pre><code>xlApp.Cells(14,1).Value="3. Here is some valid sample text:"
  xlApp.Cells(14,1).WrapText=True
  xlApp.Cells(14,1).Font.FontStyle="Plain"
  xlApp.Cells(14,1).HorizontalAlignment=-4131
  xlApp.Cells(14,1).IndentLevel = 3
  </code></pre>
  
  <p>***This is the section that doesn't work
      xlApp.Cells(15,1).Select
      xlApp.ActiveSheet.Hyperlinks.Add Anchor=Selection, Address:= _
          "<a href="http://www.testedu.edu/" rel="nofollow">http://www.testedu.edu/</a>", TextToDisplay="www.testedu.edu"</p>
  
  <hr>
  
  <pre><code>xlApp.Cells(16,1).WrapText=True
  xlApp.Cells(16,1).Font.FontStyle="Plain"
  xlApp.Cells(16,1).HorizontalAlignment=-4131
  xlApp.Cells(16,1).IndentLevel = 3
  xlApp.ActiveWorkbook.Saved=True
  </code></pre>
  
  <p>I have tried a variety of options to get an active URL created, but I can't seem to get the syntax correct. I have tried using the =HYPERLINK syntax, but wasn't successful, have tried all kinds of other stuff, but can't find the key. I'm hoping there's someone that can identify the issue and set me straight.</p>
  
  <p>Thanks!</p>
  
  <p>Mike</p>