title: Convert vba to vb6 and create a .dll - how to - hints, tips and risks
body: <p>I should convert a huge load of code which was written in VBA (Excel) to VB6. But I really do not know what I have to take care of or where to begin. Therefore it would be great to get some hints here from the VB6 experts.</p>
  
  <p>I installed already MS Visual Studio and played a bit around. But I'm not a VB6 expert and do not really know what I have to do.</p>
  
  <p>The final goal is to have all the VBA code, which is currently placed in one excel vba macro into a VB6 project and create a .dll out of it. This .dll should be referenced by the excel and the excel should run like it does now :-)</p>
  
  <p>For example what do I have to do to convert this vba code to VB6. </p>
  
  <pre><code>Public Function getParameterNumberOfMaterial() As Integer
  10        On Error Resume Next
            Dim a As String
  20        a = Sheets("Parameters").name
  
  30        If IsNumeric(Application.Worksheets(a).range("C3").Value) Then
  40            If Application.Worksheets(a).range("C3").Value &gt; 0 Then
  
  50                getParameterNumberOfMaterial = Application.Worksheets(a).range("C3").Value
  60            Else
  70                MsgBox "Please check cell C3 in the sheet 'Parameters'. It should include a numeric value which is greater than zero"
  80                MsgBox "Parameter Number of Material/Cost is set to the default value of 10"
  90                getParameterNumberOfMaterial = 10
  100           End If
  110       Else
  120           MsgBox "Please check cell C3 in the sheet 'Parameters'. It should include a numeric value which is greater than zero"
  130           MsgBox "Parameter Number of Material/Cost is set to the default value of 10"
  140           getParameterNumberOfMaterial = 10
  150       End If
  160       On Error GoTo 0
  End Function
  </code></pre>
  
  <p>Edit: Yes and if it is possible to convert vba code into a .dll this would be fine also. Then I would not have to convert the code. But I think it is only possible to create a .dll out of vb6 code.</p>