Ich habe deinen Code für das Erzeugen und Speichern eines Dokumentes mal ein bisschen überarbeitet:
Code: Alles auswählen
Sub TextCursor
sText = "NameTestDatei"
CreateDocument(sText)
End Sub
Sub CreateDocument(sText)
Dim oDesktop as Object
Dim sUrl as String
Dim mNoArgs()
Dim oDocument as Object
Dim sSave as String
Dim mFileProperties(0) as New com.sun.star.beans.PropertyValue
oDesktop = createUnoService("com.sun.star.frame.Desktop")
sUrl = "private:factory/swriter"
oDocument = oDesktop.loadComponentFromURL(sUrl, "_blank", 0, mNoArgs())
oFrame = oDocument.CurrentController.frame
Tittel = sText & ".odt"
oFrame.Title = Tittel
sSave = "file:///E:/" & Tittel
oDocument.StoreAsURL(sSave,mFileProperties())
End Sub
Charly