Bei einer nicht geöffneten Datei mache einfach eine Kopie über das Betriebssytem (F1: FileCopy)
Hast Du die Datei geöffnet (und im Vordergrund) funktioniert hier folgender Code (bei allen bereits einmal gespeicherten OOo-Dokumenten)
Code: Alles auswählen
oDok = ThisComponent
'XXX warning
'XXX code will fail on next statement, if no document is loaded
' check if file was stored
If oDok.hasLocation() then
' check if HELP window is in foreground
If Instr( oDok.getLocation() , "vnd.sun.star.help:" ) then
' msgbox "HELP window in foreground"
' exit without action
Exit Sub
End if
' yes, make a copy
' compose additional data to create alternative name for file
' here: datestamp in ISO format used (good for sorting)
sFileURL = oDok.getURL() & "_" & cDateToISO( Now() )
' check if such a file exist
if FileExists( sFileURL ) then
' yes there is one
' issue a message to inform user
msgbox cDokGefunden & chr(13) &_
sFileURL & chr(13) & _
cNoCopyMade ,_
64 ,sMakroName & sMakroVersion
else
' check if we have rights to save there under this name
' how ???
' can save with new name
'## note: no checking on length of filename
'## restricted on some platforms
'## untested _ not sure what will happen
oDok.StoreToURL( sFileURL , Array() )
end if
Gespeichert wird Datenbank.odb_20100809
Für mich ist das ausreichend...-hilft Dir das?