ich würde gerne meine Calc Dokumente per Makro ohne Schreibschutz öffnen.
Wenn ich sie so (mit schreibschutz) öffne, kommt keine Fehlermeldung und das Dokumet wird geöffnet.
Sub Main
Dim sUrl1 as string
Dim myProps(0) as New com.sun.star.beans.PropertyValue
sUrl1 = convertToURL("C:\TestA.ods")
myProps(0).Name="ReadOnly"
myProps(0).Value = true
oDocument = StarDesktop.loadComponentFromURL(sUrl1, "_blank", 0, myProps() )
End Sub
Setze ich jedoch den ReadOnly Wert auf false kommt immer eine Fehlermeldung:
Sub Main
Dim sUrl1 as string
Dim myProps(0) as New com.sun.star.beans.PropertyValue
sUrl1 = convertToURL("C:\TestA.ods")
myProps(0).Name="ReadOnly"
myProps(0).Value = false
oDocument = StarDesktop.loadComponentFromURL(sUrl1, "_blank", 0, myProps() )
End Sub
Sub DokumentOeffnen
Dim sUrl1 as string
Dim myProps(0) as New com.sun.star.beans.PropertyValue
sUrl1 = convertToURL("C:\Test.ods")
myProps(0).Name="ReadOnly"
myProps(0).Value = false
On Error GoTo Failed
oDocument = StarDesktop.loadComponentFromURL(sUrl1, "_blank", 0, myProps() )
Failed:
MsgBox "Die Datei ist bereits geöffnet"
End Sub
Viel Erfolg.
Jürgen
Software hat keinen Verstand - benutze deinen eigenen...!