Hallo,
ich stelle gerade von Excel auf Calc (OO 3.1) um und bräuchte mal eure Hilfe wie ich ein Macro, dass ein anderes Calc-Dokument öffnet und unter einem neuen Namen abscpeichert hinbekomme?
In Excel sah das folgendermaßen aus:
Private Sub criarCliente\_Click()
Dim x
x = Cells(3, 2)
Dim y
y = Cells(3, 4)
' open the checklist-document, fill it with clients-name and product, save it, close calcular-encomenda.xls
Workbooks.Open (ThisWorkbook.Path & Application.PathSeparator & "documentos-adicionais" & "\" & "checklist.xls")
Sheets("anexos").Range("A2").Value = y
Sheets("radiadores").Range("E3").Value = x
Sheets("radiadores").Range("E4").Value = y
ActiveWorkbook.SaveAs (ActiveWorkbook.Path & Application.PathSeparator & "..\clientes" & "\" & x & "-" & y & ".xls")
Windows("calcular-encomenda.xls").Activate
ActiveWindow.Close savechanges:=False
End Sub
Folgenden Code zum Öffnen eines andern Dokuments habe ich mir ergooglet (ich verscuhe stückweise vor zu gehen):
Sub criarCliente
Dim DirectoryName as String
Dim NewWorkbook as Object
Dim Args(0) as new com.sun.star.beans.PropertyValue
Rem Assume DirectoryName variable contains directory
Rem location of the currently active workbook
Args(0).Name = "MacroExecutionMode"
Args(0).Value = \_
com.sun.star.document.MacroExecMode.ALWAYS\_EXECUTE
NewWorkbook = StarDesktop.loadComponentFromURL \_
("file:///" & DirectoryName & "/2.ods", \_
"\_blank",0 ,Args() )
Allerdings erzeugt er bei mir die Fehlermeldung: Url seems to be an unsopported one.
Kann mir jemand sagen, was ich falsch mache?
mfg,
David