title: How to port Excel VBA macro to OpenOffice macro?
body: <p>How to port Excel VBA macro to OpenOffice macro?</p>
  
  <p>Here is macro for creating hyperlinks:</p>
  
  <pre><code>Sub HyperMaker()
      Dim r As Range
      Dq = Chr(34)
      For Each r In Selection
          r.Formula = "=HYPERLINK(" &amp; Dq &amp; "http://" &amp; r.Text &amp; Dq &amp; ";" &amp; Dq &amp; r.Text &amp; Dq &amp; ")"
      Next r
  End Sub
  </code></pre>
  
  <p>I tried convert this macro to OpenOffice macro (using <a href="http://www.business-spreadsheets.com/vba2oo.asp" rel="nofollow">http://www.business-spreadsheets.com/vba2oo.asp</a>)</p>
  
  <pre><code>Sub HyperMaker()
  Dim r As Dim oSheet as Object[n]oSheet = ThisComponent.CurrentController.ActiveSheet[n]oSheet.getCellRangeByName($1)
  Dq = Chr(34)
  For Each r In Selection
  r.Formula = "=HYPERLINK(" &amp; Dq &amp; "http://" &amp; r.Text &amp; Dq &amp; ";" &amp; Dq &amp; r.Text &amp; Dq &amp; ")"
  Next r
  End Sub
  </code></pre>
  
  <p>But got errors: <code>BASIC syntax error: Unexpected symbol: Dim.</code> , <code>Expected:,.</code></p>
  
  <p>Replacing Dim with comma not help.
  How to make it work in OpenOfffice?</p>