Hallo an alle, hier mal das makro letzter Stand (funktioniert bei mir wie gesagt bis zum einsetzen der Daten in ein zweites Tabellenblatt).
Wußte nicht wie sonst hier reinstellen und hab jetzt einfach aus dem Makroeditor raus kopiert:
Vieleicht kennt jemand ein Tutorial o. ä. um sich die Grundbegriffe von BASIC anzueignen...
Code: Alles auswählen
Sub Main
p = createUnoService( "com.sun.star.util.PathSubstitution" )
msgbox p.substituteVariables("$(USER)/uno_packages/",1)
End Sub
sub ErzeugeExportDatei_01
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Tables"
args1(0).Value = Array(4)
dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Sel"
args2(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Sel"
args3(0).Value = true
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args3())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Sel"
args5(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "Tables"
args6(0).Value = Array(5)
dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args6())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Sel"
args7(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args7())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Sel"
args8(0).Value = true
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args8())
rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "StringName"
args9(0).Value = " "
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args9())
rem ----------------------------------------------------------------------
dim args10(0) as new com.sun.star.beans.PropertyValue
args10(0).Name = "Sel"
args10(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args10())
rem ----------------------------------------------------------------------
dim args11(5) as new com.sun.star.beans.PropertyValue
args11(0).Name = "Flags"
args11(0).Value = "SVDT"
args11(1).Name = "FormulaCommand"
args11(1).Value = 0
args11(2).Name = "SkipEmptyCells"
args11(2).Value = false
args11(3).Name = "Transpose"
args11(3).Value = false
args11(4).Name = "AsLink"
args11(4).Value = false
args11(5).Name = "MoveMode"
args11(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args11())
rem ----------------------------------------------------------------------
dim args12(0) as new com.sun.star.beans.PropertyValue
args12(0).Name = "Sel"
args12(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args12())
end sub
sub ErzeugeExportDatei_02
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Tables"
args1(0).Value = Array(4)
dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Sel"
args2(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Sel"
args3(0).Value = true
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args3())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Sel"
args5(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "Tables"
args6(0).Value = Array(5)
dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args6())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Sel"
args7(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args7())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Sel"
args8(0).Value = true
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args8())
rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "StringName"
args9(0).Value = " "
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args9())
rem ----------------------------------------------------------------------
dim args10(0) as new com.sun.star.beans.PropertyValue
args10(0).Name = "Sel"
args10(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args10())
rem ----------------------------------------------------------------------
dim args11(5) as new com.sun.star.beans.PropertyValue
args11(0).Name = "Flags"
args11(0).Value = "SVDT"
args11(1).Name = "FormulaCommand"
args11(1).Value = 0
args11(2).Name = "SkipEmptyCells"
args11(2).Value = false
args11(3).Name = "Transpose"
args11(3).Value = false
args11(4).Name = "AsLink"
args11(4).Value = false
args11(5).Name = "MoveMode"
args11(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args11())
rem ----------------------------------------------------------------------
dim args12(0) as new com.sun.star.beans.PropertyValue
args12(0).Name = "Sel"
args12(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args12())
rem ----------------------------------------------------------------------
dim args13(2) as new com.sun.star.beans.PropertyValue
args13(0).Name = "URL"
args13(0).Value = "file:///T:/DOW_Arbeit/Aktuelles/Matthias/Export_Makro/EXPORTAKTUELL.csv"
args13(1).Name = "FilterName"
args13(1).Value = "Text - txt - csv (StarCalc)"
args13(2).Name = "FilterOptions"
args13(2).Value = "59,34,ANSI,1,,0,false,true,true,false"
dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args13())
end sub
sub ErzeugeExportDatei_Beispiel01
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Tables"
args1(0).Value = Array(3)
dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Sel"
args2(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Sel"
args3(0).Value = true
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args3())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Sel"
args5(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "Tables"
args6(0).Value = Array(4)
dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args6())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Sel"
args7(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args7())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Sel"
args8(0).Value = true
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args8())
rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "StringName"
args9(0).Value = " "
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args9())
rem ----------------------------------------------------------------------
dim args10(0) as new com.sun.star.beans.PropertyValue
args10(0).Name = "Sel"
args10(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args10())
rem ----------------------------------------------------------------------
dim args11(5) as new com.sun.star.beans.PropertyValue
args11(0).Name = "Flags"
args11(0).Value = "SVDT"
args11(1).Name = "FormulaCommand"
args11(1).Value = 0
args11(2).Name = "SkipEmptyCells"
args11(2).Value = false
args11(3).Name = "Transpose"
args11(3).Value = false
args11(4).Name = "AsLink"
args11(4).Value = false
args11(5).Name = "MoveMode"
args11(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args11())
rem ----------------------------------------------------------------------
dim args12(0) as new com.sun.star.beans.PropertyValue
args12(0).Name = "Sel"
args12(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args12())
end sub
sub ErzeugeExportDatei_Beispiel02
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Tables"
args1(0).Value = Array(3)
dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Sel"
args2(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Sel"
args3(0).Value = true
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args3())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Sel"
args5(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "Tables"
args6(0).Value = Array(4)
dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args6())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Sel"
args7(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args7())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Sel"
args8(0).Value = true
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args8())
rem ----------------------------------------------------------------------
dim args9(0) as new com.sun.star.beans.PropertyValue
args9(0).Name = "StringName"
args9(0).Value = " "
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args9())
rem ----------------------------------------------------------------------
dim args10(0) as new com.sun.star.beans.PropertyValue
args10(0).Name = "Sel"
args10(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args10())
rem ----------------------------------------------------------------------
dim args11(5) as new com.sun.star.beans.PropertyValue
args11(0).Name = "Flags"
args11(0).Value = "SVDT"
args11(1).Name = "FormulaCommand"
args11(1).Value = 0
args11(2).Name = "SkipEmptyCells"
args11(2).Value = false
args11(3).Name = "Transpose"
args11(3).Value = false
args11(4).Name = "AsLink"
args11(4).Value = false
args11(5).Name = "MoveMode"
args11(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args11())
rem ----------------------------------------------------------------------
dim args12(0) as new com.sun.star.beans.PropertyValue
args12(0).Name = "Sel"
args12(0).Value = false
dispatcher.executeDispatch(document, ".uno:GoToStart", "", 0, args12())
end sub