Obrabiałem pola tekstowe w PowerPoincie, ale mysle ze w Excelu bedzie identycznie (względnie podobnie :-)).
Najpierw trzeba znać consty typów obiektów
'Type 1
Case msoAutoShape
it = "an AutoShape. Type : " & .Type
'Type 2
Case msoCallout
it = "a Callout. Type : " & .Type
'Type 3
Case msoChart
it = "a Chart. Type : " & .Type
'Type 4
Case msoComment
it = "a Comment. Type : " & .Type
'Type 5
Case msoFreeform
it = "a Freeform. Type : " & .Type
'Type 6
Case msoGroup
it = "a Group. Type : " & .Type
' If it's a group them iterate thru
' the items and list them
it = it & vbCrLf & "Comprised of..."
For Ctr = 1 To .GroupItems.Count
it = it & vbCrLf & _
.GroupItems(Ctr).Name & _
". Type:" & .GroupItems(Ctr).Type
Next Ctr
'Type 7
Case msoEmbeddedOLEObject
it = "an Embedded OLE Object. Type : " & .Type
'Type 8
Case msoFormControl
it = "a Form Control. Type : " & .Type
'Type 9
Case msoLine
it = "a Line. Type : " & .Type
'Type 10
Case msoLinkedOLEObject
it = "a Linked OLE Object. Type : " & .Type
With .LinkFormat
it = it & vbCrLf & "My Source: " & _
.SourceFullName
End With
'Type 11
Case msoLinkedPicture
it = "a Linked Picture. Type : " & .Type
With .LinkFormat
it = it & vbCrLf & "My Source: " & _
.SourceFullName
End With
'Type 12
Case msoOLEControlObject
it = "an OLE Control Object. Type : " & .Type
'Type 13
Case msoPicture
it = "a embedded picture. Type : " & .Type
'Type 14
Case msoPlaceholder
it = "a text placeholder (title or regular text--" & _
"not a standard textbox) object." & _
"Type : " & .Type
'Type 15
Case msoTextEffect
it = "a WordArt (Text Effect). Type : " & .Type
'Type 16
Case msoMedia
it = "a Media object .. sound, etc. Type : " & .Type
With .LinkFormat
it = it & vbCrLf & " My Source: " & _
.SourceFullName
End With
'Type 17
Case msoTextBox
it = "a Text Box."
'Type 18 = msoScriptAnchor, not defined in PPT pre-2000 so we use the numeric value
'Case msoScriptAnchor
Case 18
it = " a ScriptAnchor. Type : " & .Type
'Type 19 = msoTable, not defined in PPT pre-2000 so we use the numeric value
'Case msoTable
Case 19
it = " a Table. Type : " & .Type
'Type 19 = msoCanvas, not defined in PPT pre-2000 so we use the numeric value
'Case msoCanvas
Case 20
it = " a Canvas. Type : " & .Type
'Type 21 = msoDiagram, not defined in PPT pre-2000 so we use the numeric value
'Case msoDiagram
Case 22
it = " a Diagram. Type : " & .Type
'Type 22 = msoInk, not defined in PPT pre-2000 so we use the numeric value
'Case msoInk
Case 22
it = " an Ink shape. Type : " & .Type
'Type 23 = msoInkComment, not defined in PPT pre-2000 so we use the numeric value
'Case msoInkComment
Case 23
it = " an InkComment. Type : " & .Type
W PPT jest tak:
CountShape := PPT.ActivePresentation.Slides.Item(IndexSlide).Shapes.Count;
for I := 1 to CountShape do
begin
TypShape := PPT.ActivePresentation.Slides.Item(IndexSlide).Shapes.Item(I).Type;
if(TypShape in [1,14,17]) then //textbox i inne typu tekstowego
Text := PPT.ActivePresentation.Slides.Item(IndexSlide).Shapes.Item(I).TextFrame.TextRange;
end;
Po lekkiej modyfikacji z ActivePresentation.Slides na WorkBook[1].WorkSheets[X] może zadziała bez poprawek.
Zawsze można otworzyć makro w Excelu i tam masz InteliSense żeby sprawdzić funkcje