.sxc nach xls umwandeln
Verfasst: Di, 16.12.2003 18:11
Hallo,
ich bekomme öfters .sxc-Dateien (Tabellenkalkulationen) per Mail benötige Sie aber im MS Excel 97 Format. Bisher habe ich die Datei in OpenOffice geöffnet und anschliessend in MS Excel Format abgespeichert.
Bei ein bis drei Dateien ist das noch ok, aber jetzt zum Jahresende sind das bis zu 100 Dateien. Da nervt das ganze öffnen und speichern unter natürlich. Deswegen wollte ich das ganze dann über ein Makro laufen lassen. Aber das klappt leider nicht. Kann mir vielleicht jemand helfen?
Ich hoffe jemand von Euch kann mir dabei helfen.
Danke schon mal im voraus.
Bis dann...
CB
ich bekomme öfters .sxc-Dateien (Tabellenkalkulationen) per Mail benötige Sie aber im MS Excel 97 Format. Bisher habe ich die Datei in OpenOffice geöffnet und anschliessend in MS Excel Format abgespeichert.
Bei ein bis drei Dateien ist das noch ok, aber jetzt zum Jahresende sind das bis zu 100 Dateien. Da nervt das ganze öffnen und speichern unter natürlich. Deswegen wollte ich das ganze dann über ein Makro laufen lassen. Aber das klappt leider nicht. Kann mir vielleicht jemand helfen?
Code: Alles auswählen
sub Test
rem Variablen deklarieren
Dim Document_in As Object
Dim Document_out As Object
Dim Dispatcher As Object
Dim Datei As String
Dim InputPath As String
Dim OutputPath As String
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim z As Integer
rem Variablen initialisieren
Dim args2(1) as new com.sun.star.beans.PropertyValue
Dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
InputPath = "file:///X:/sxc/"
OutputPath = "file:///X:/xls/"
a = 0
b = 0
c = 0
z = 0
While a < 2
b = 0
While b < 10
c = 0
While c < 10
Datei = "File" & a & b & c
If FileExists(InputPath & Datei & ".sxc") Then
Document_in = Desktop.LoadComponentFromURL(InputPath & Datei & ".sxc", "_blank", 0, args)
Dispatcher.executeDispatch(Document_in, ".uno:Open", "", 0, Array())
Set Document_out = ThisComponent.CurrentController.Frame
args2(0).Name = "URL"
args2(0).Value = OutputPath & Datei & ".xls"
args2(1).Name = "FilterName"
args2(1).Value = "MS Excel 97"
Dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args2())
MsgBox "Die Datei " & Datei & ".sxc wurde als " & Datei & ".xls unter " & OutputPath & " gespeichert." , 64, "Hinweis"
z = z + 1
EndIf
c = c + 1
Wend
b = b + 1
Wend
a = a + 1
Wend
MsgBox "Es wurden " & z & " Dateien umgewandelt.", 64, "Abschluss"
End Sub
Danke schon mal im voraus.
Bis dann...
CB