|
本帖最后由 ning84 于 2023-3-22 10:44 编辑
ActiveWindow.Selection.ShapeRange的应用。
- Set ShpRng = Application.ActiveWindow.Selection.ShapeRange
- Debug.Print ShpRng.Name
- Stop
- ShpRng.Name = "T1"
- Debug.Print ShpRng.Name
复制代码- Private Sub ll3()
- Dim xChart As Chart
- Dim Sht As Worksheet
- Set xChart = Application.ActivePresentation.Slides(1).Shapes("C1").Chart
- ''
- xChart.ChartData.Activate
- 'Stop
- Set Sht = xChart.ChartData.Workbook.Worksheets(1)
- Debug.Print Sht.Name
- Stop
- Dim Shp As Shape, Kk
- Dim ShpRng As ShapeRange
- Dim TxtRng2 As TextRange2
- Kk = 1
- For Each Shp In Application.ActivePresentation.Slides(1).Shapes
- If Shp.Type = 1 Then
- Set TxtRng2 = Shp.TextFrame2.TextRange
- Debug.Print Shp.Name, Shp.Type, TxtRng2.Text
- Shp.Name = "N" & Kk
- Kk = Kk + 1
- Sht.Cells(Kk + 14, 1) = Shp.Name
- Sht.Cells(Kk + 14, 2) = TxtRng2.Text
- End If
- Next Shp
-
- End Sub
复制代码
|
|