Function NeuesDokument(Optional intTyp As Integer) As Object
   Dim objDesktop As Object
   Dim objDokument As Object
   Dim strModul As String

   If IsMissing(intTyp) Then
      intTyp = 1
   End If

   Select Case intTyp
   Case 2
      strModul = "scalc"
   Case 3
      strModul = "sdraw"
   Case Else
      strModul = "swriter"
   End Select

   objDesktop = createUnoService("com.sun.star.frame.Desktop")
   NeuesDokument = objDesktop.loadComponentFromURL _
   ("private:factory/" & strModul, "_blank", 0, mNoArgs())
End Function
