ppt zugriff aus excel vba
16.03.2005 10:59:51
tom
ich versuche aus einer Excel tabelle die daten einzelner zellen in textboxen nach ppt "transferieren" und diese gruppieren. (und dann manuell weitermachen)
Ich finde leider keine lösung, wie ich es hinbekomme, dass er die textboxen variabel ansprechen kann. heisst nach jeder schleife heissen die textboxen anders.
zb.
1. schleife
textbox 1, textbox 2, textbox 3, textbox 4,
2. schleife
textbox 5, textbox 6, textbox 7, textbox 8,
ich wollte einen counter einbauen(tb1= tb1+4), damit er immer wieder zum gruppieren auf die grade neu angelegten textboxen zugreifen kann(um diese dann zu gruppieren)
ich hab es so versucht die textboxen variabel anzusprechen. aber er sagt immer wieder nicht gefunden:
myDocument.Shapes.Range(Array("Text Box" & tb1, "Text Box" & tb2, "Text Box" & tb3, "Text Box" & tb4)).Group
Ich komm seit gestern Abend nicht mehr weiter damit. kann mir bitte jemand helfen?
hier nochmal der ganze code (ist noch ohne counter, hab die variablen manuell deklariert)
Sub bubbles_anlegen()
Set appPowerPt = CreateObject("PowerPoint.Application")
appPowerPt.Visible = True
appPowerPt.Presentations.Open Filename:="C:\Testing\Test.ppt"
Set myDocument = appPowerPt.Presentations(1).slides(1)
'hier Anfang Schleife
ThisWorkbook.Activate
Range("A2").Select
appPowerPt.Activate
'ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeOval, 60#, 48#, 294#, 114#).Add
Do Until ActiveCell.Value = ""
ThisWorkbook.Activate
komp = ActiveCell.Value
ActiveCell.Cells(1, 2).Select
ist = ActiveCell.Value
ActiveCell.Cells(1, 2).Select
soll = ActiveCell.Value
ActiveCell.Cells(1, 2).Select
fl = ActiveCell.Value
'zuordnungstabelle textboxen
'start ppt routine
With myDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, _
100, 200, 300, 50).TextFrame 'komp
.TextRange.Text = "Kernkompetenz: " & komp
'.Caption = "testname"
End With
'myDocument.ActiveForm.Caption = testname
With myDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, _
70, 170, 100, 50).TextFrame 'Ist
.TextRange.Text = "Ist: " & ist
End With
With myDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, _
70, 230, 100, 50).TextFrame 'Soll
.TextRange.Text = "Soll: " & soll
End With
With myDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, _
200, 170, 100, 50).TextFrame 'Fl
.TextRange.Text = "FL: " & fl
End With
'myDocument.activetextbox.Name = "tbtest"
'zuordungstabelle
tb1 = 5
tb2 = 6
tb3 = 7
tb4 = 8
'gruppieren
'myDocument.Shapes.Range(Array("Text Box" & tb1, "Text Box" & tb2)).Group
myDocument.Shapes.Range(Array("Text Box" & tb1, "Text Box" & tb2, "Text Box" & tb3, "Text Box" & tb4)).Group
'end ppt routine
ThisWorkbook.Activate
ActiveCell.Offset(1, -3).Select
Loop
End Sub
viele grüße
Thomas