von traveler_frank » Do, 05.02.2009 18:40
Hallo Leute,
Wer kann mir bei der Umsetzung Excel -> Ooo 3.0 helfen ?
Code: Alles auswählen
Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Sub projektneu()
On Error Resume Next
'Blatt für Projekt anlegen:
Sheets("Start").Select
pname = ActiveCell(1, 1).Value
Sheets("Vorlage").Visible = True
Sheets("Vorlage").Copy After:=Sheets("Start")
ActiveSheet.Name = pname
ActiveSheet.Range("AF2").Value = pname
If Err.Number <> 0 Then
MsgBox ("Projekt-Blatt bereits vorhanden")
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = False
Sheets("Vorlage").Visible = False
Sheets(pname).Activate
Exit Sub
End If
ActiveWorkbook.Save
Sheets("Vorlage").Visible = False
End Sub
Sub uebertrag()
'Zeit übertragen
On Error Resume Next
ActiveSheet.Range("AF2").Select
Set pname = ActiveCell(1, 1)
ActiveSheet.Range("AG47").Select
Set pzeit = ActiveCell(1, 1)
Worksheets("Start").Range("b4:c20").Find(pname).Cells(1, 1 + 1).Value = pzeit
Range("f15").Select
Worksheets("Start").Activate
ActiveWorkbook.Save
End Sub
Sub anzeige()
'projekt anzeigen
On Error Resume Next
pname = ActiveCell(1, 1).Value
Sheets(pname).Activate
End Sub
Sub sortieren()
On Error Resume Next
'Projekte sortieren
Range("b4").Select
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("f15").Select
End Sub
Sub einblenden()
Sheets("Vorlage").Visible = True
Sheets("Vorlage").Activate
End Sub
Sub ausblenden()
Sheets("Vorlage").Visible = False
End Sub
Sub hilfe()
Range("a25").Select
End Sub
nun habe ich volgenden Ansatz und ein Problem
Code: Alles auswählen
sub Laden
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
Dim objDoc as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
objDoc = ThisComponent
rem ----------------------------------------------------------------------
rem Load and Set Scheet
rem-----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "aTableName"
args1(0).Value = "Vorlage Ausland"
dispatcher.executeDispatch(document, ".uno:Show", "", 0, args1())
Sheet = ThisComponent.Sheets.getByName("Vorlage Ausland")
ThisComponent.CurrentController.setActiveSheet(Sheet)
rem ----------------------------------------------------------------------
rem Go to Cell AF2 and get Data in Cell
dim args2(0) as new com.sun.star.beans.PropertyValue
REM--HIER MEIN PROB ----
args2(0).Name = "ToPoint" ' Hier Sollte Spalte B immer fest
args2(0).Value = "$AF$2" ' und Hier Aktuelle Zelle in Spalte "B" sein ??????? wie ist es möglich ????
REM--HIER MEIN PROB ----
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
strCellValue = objDoc.getCurrentSelection.getstring
rem ----------------------------------------------------------------------
rem Copy Sheet
rem-----------------------------------------------------------------------
dim args3(2) as new com.sun.star.beans.PropertyValue
args3(0).Name = "DocName"
args3(0).Value = "RK-2009"
args3(1).Name = "Index"
args3(1).Value = 32767
args3(2).Name = "Copy"
args3(2).Value = true
dispatcher.executeDispatch(document, ".uno:Move", "", 0, args3())
rem ----------------------------------------------------------------------
rem Rename Scheet
rem-----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "Name"
args4(0).Value = "" & strCellValue
dispatcher.executeDispatch(document, ".uno:RenameTable", "", 1, args4())
rem ----------------------------------------------------------------------
rem Hide Scheet
rem-----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "aTableName"
args5(0).Value = "Vorlage Ausland"
dispatcher.executeDispatch(document, ".uno:Hide", "", 0, args5())
end sub
Hallo Leute,
Wer kann mir bei der Umsetzung Excel -> Ooo 3.0 helfen ?
[code] Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Sub projektneu()
On Error Resume Next
'Blatt für Projekt anlegen:
Sheets("Start").Select
pname = ActiveCell(1, 1).Value
Sheets("Vorlage").Visible = True
Sheets("Vorlage").Copy After:=Sheets("Start")
ActiveSheet.Name = pname
ActiveSheet.Range("AF2").Value = pname
If Err.Number <> 0 Then
MsgBox ("Projekt-Blatt bereits vorhanden")
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = False
Sheets("Vorlage").Visible = False
Sheets(pname).Activate
Exit Sub
End If
ActiveWorkbook.Save
Sheets("Vorlage").Visible = False
End Sub
Sub uebertrag()
'Zeit übertragen
On Error Resume Next
ActiveSheet.Range("AF2").Select
Set pname = ActiveCell(1, 1)
ActiveSheet.Range("AG47").Select
Set pzeit = ActiveCell(1, 1)
Worksheets("Start").Range("b4:c20").Find(pname).Cells(1, 1 + 1).Value = pzeit
Range("f15").Select
Worksheets("Start").Activate
ActiveWorkbook.Save
End Sub
Sub anzeige()
'projekt anzeigen
On Error Resume Next
pname = ActiveCell(1, 1).Value
Sheets(pname).Activate
End Sub
Sub sortieren()
On Error Resume Next
'Projekte sortieren
Range("b4").Select
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("f15").Select
End Sub
Sub einblenden()
Sheets("Vorlage").Visible = True
Sheets("Vorlage").Activate
End Sub
Sub ausblenden()
Sheets("Vorlage").Visible = False
End Sub
Sub hilfe()
Range("a25").Select
End Sub [/code]
nun habe ich volgenden Ansatz und ein Problem
[code] sub Laden
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
Dim objDoc as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
objDoc = ThisComponent
rem ----------------------------------------------------------------------
rem Load and Set Scheet
rem-----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "aTableName"
args1(0).Value = "Vorlage Ausland"
dispatcher.executeDispatch(document, ".uno:Show", "", 0, args1())
Sheet = ThisComponent.Sheets.getByName("Vorlage Ausland")
ThisComponent.CurrentController.setActiveSheet(Sheet)
rem ----------------------------------------------------------------------
rem Go to Cell AF2 and get Data in Cell
dim args2(0) as new com.sun.star.beans.PropertyValue
REM--HIER MEIN PROB ----
args2(0).Name = "ToPoint" ' Hier Sollte Spalte B immer fest
args2(0).Value = "$AF$2" ' und Hier Aktuelle Zelle in Spalte "B" sein ??????? wie ist es möglich ????
REM--HIER MEIN PROB ----
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
strCellValue = objDoc.getCurrentSelection.getstring
rem ----------------------------------------------------------------------
rem Copy Sheet
rem-----------------------------------------------------------------------
dim args3(2) as new com.sun.star.beans.PropertyValue
args3(0).Name = "DocName"
args3(0).Value = "RK-2009"
args3(1).Name = "Index"
args3(1).Value = 32767
args3(2).Name = "Copy"
args3(2).Value = true
dispatcher.executeDispatch(document, ".uno:Move", "", 0, args3())
rem ----------------------------------------------------------------------
rem Rename Scheet
rem-----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "Name"
args4(0).Value = "" & strCellValue
dispatcher.executeDispatch(document, ".uno:RenameTable", "", 1, args4())
rem ----------------------------------------------------------------------
rem Hide Scheet
rem-----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "aTableName"
args5(0).Value = "Vorlage Ausland"
dispatcher.executeDispatch(document, ".uno:Hide", "", 0, args5())
end sub
[/code]