|
楼主 |
发表于 2024-9-11 22:41
|
显示全部楼层
学习学再学习。
- Function AddLable(Shps, Rng As Range)
- Dim Sht As Worksheet
- Dim S As Shape
- Dim msoShape As MsoAutoShapeType
- Dim Str
- Dim Cc As Integer, Ll, Tt, Ww, Hh, fSize
- Cc = 1
- Ll = Rng(, Cc + 1)
- Tt = Rng(, Cc + 2)
- Ww = Rng(, Cc + 3)
- Hh = Rng(, Cc + 4)
- fSize = Rng(, Cc + 5)
-
-
- Dim Shp ', Shps, s As Shape, Ss As Shapes
- Dim TxtRng 'As TextRange2
- '''
- For ii = 1 To Rng.Rows.Count
- Set Shp = Shps.AddLabel(msoTextOrientationHorizontal, Ll, Tt, Ww, Hh)
- With Shp
- .Name = "Txt" & ii
- '.TextEffect.Text = Rng(ii, Cc)
- Str = Rng(ii, Cc)
- .TextFrame2.TextRange.text = Str
- ''
- nn = Len(Rng(ii, "W"))
- ''
- Set TxtRng = .TextFrame.TextRange
- TxtRng.Select
- ''
- TxtRng.Characters(1, nn + 1).Font.Size = fSize
- TxtRng.Characters(nn + 1, Len(Str) - nn + 2).Font.Size = fSize * 0.8
- 'Debug.Print Rng(, Cc + 6).Address, Rng(, Cc + 6)
- msoShape = Rng(, Cc + 6)
- .AutoShapeType = msoShape
- .Line.Visible = True
-
- '.TextEffect.FontSize = Rng(, Cc + 7)
-
- End With
- Next ii
- End Function
- Sub RngToSldTextbox()
- Dim Ppt As New PowerPoint.Application
- Set Ppt = New PowerPoint.Application
- Dim Rng As Range
- Set Rng = Selection
- Dim Sht As Worksheet
- Set Sht = Rng.Parent
- Dim Pres As Presentation
- Dim Sld As Slide
- Dim ShpRng, Shp
-
- Dim SldRng 'As SlideRange
- Set SldRng = Ppt.ActiveWindow.Selection.SlideRange
- Set Shps = SldRng.Shapes
- For ii = Shps.Count To 1 Step -1
- Set Shp = Shps(ii)
- If Shp.Type = msoTextBox Then
- Shp.Delete
- End If
- Next ii
- '''
- For ii = 1 To Rng.Rows.Count
- AddLable Shps, Sht.Cells(Rng(ii, 1).Row, "A")
- Next ii
- End Sub
复制代码
|
|