|
楼主 |
发表于 2024-8-14 08:35
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 ning84 于 2024-8-14 16:03 编辑
- Sub ll()
- Dim ShpRng As ShapeRange
- Dim Sld As Slide
- Dim Shp As Shape, Shps As Shapes
- Set Sld = Application.ActivePresentation.Slides(1)
- Set Shps = Sld.Shapes
- Set ShpRng = Application.ActiveWindow.Selection.ShapeRange
- Set Shp = Shps(ShpRng.Name)
- Stop
-
- Debug.Print ShpRng.Name
- With Shp
- Debug.Print .Name, .AutoShapeType
- .AutoShapeType = msoShape10pointStar
- .Fill.BackColor.ObjectThemeColor = msoThemeColorText1
- 'ShpRng.Glow.Color.ObjectThemeColor = msoThemeColorAccent3
- End With
- End Sub
复制代码
- '''
- Sub ColumnFToNotePageShapes2()
- Dim Str
- Dim Fso As FileSystemObject, oFile As File
- Set Fso = New FileSystemObject
- Dim MenuSht As Worksheet, Sht As Worksheet, oSht As Worksheet
- Dim Rng As Range, MenuRng As Range
- Set Rng = Selection.CurrentRegion
- Set Sht = Rng.Parent
- Debug.Print Rng.Address
- Dim Shp2 'As Shape
- Dim Shp3 ' As Shape
- Dim PathName
- PathName = ThisWorkbook.Path & "" & Sht.Name & ".Pptx"
- Dim Pres As Presentation
- Set Pres = OpenPpt(Fso, PathName)
-
- Dim Sld As Slide, Slds As Slides
- Set Slds = Pres.Slides
- Dim PicShp, Shp ' As Shape
- Dim ShpRng 'As ShapeRange
- Dim TxtArr(2)
- For ii = 1 To Rng.Rows.Count - 1
- Str = Sht.Cells(Rng(ii, 1).Row, "B")
- Set Sld = Slds(ii) '(Str)
- 'Sld.NotesPage.Shapes(2).TextFrame2.TextRange.Text = Sht.Cells(Rng(ii, 1).Row, "F") & Chr(10) & "#"
- TxtArr(0) = Sht.Cells(Rng(ii, 1).Row, "D")
- TxtArr(1) = Sht.Cells(Rng(ii, 1).Row, "E")
- TxtArr(2) = Sht.Cells(Rng(ii, 1).Row, "F")
- Txt1Txt2Txt3 Sld.Shapes, TxtArr
- Next ii
-
- Beep
- End Sub
- Function Txt1Txt2Txt3(Shps, TxtArr)
- Dim S As Shapes
-
- Dim Shp 'As Shape
- Dim ShpRng 'As ShapeRange
- Dim Arr(2)
- Arr(0) = Array("Txt1", 5, 5, 700, 30, msoShapeChevron, msoThemeColorAccent6, 12, ppAutoSizeShapeToFitText, msoFalse)
- Arr(1) = Array("Txt2", 410, 25, 285, 490, 0, 0, 16, 0, 0)
- Arr(2) = Array("Txt3", 275, 465, 345, 75, msoShapePlaque, msoThemeColorAccent1, 18, ppAutoSizeShapeToFitText, msoFalse)
- For ii = Shps.Count To 2 Step -1
- Set Shp = Shps(ii)
- Shp.Delete
- Next ii
- For ii = 0 To 2
- Set Shp = Shps.AddLabel(msoTextOrientationHorizontal, 0, 0, 100, 50)
- Shp.Name = Arr(ii)(0)
- Set Shp = Shps(Arr(ii)(0))
- ''
- With Shp
- .TextFrame2.TextRange.Text = TxtArr(ii) 'Arr(ii)(0)
- .Name = Arr(ii)(0)
- .Left = Arr(ii)(1)
- .Top = Arr(ii)(2)
- .Width = Arr(ii)(3)
- .Height = Arr(ii)(4)
- 'Debug.Print .Left, ","; .Top, ",", .Width, ","; .Height
- If Arr(ii)(5) <> 0 Then
- .AutoShapeType = Arr(ii)(5)
- .Fill.BackColor.ObjectThemeColor = Arr(ii)(6)
- .TextFrame2.TextRange.Font.Size = Arr(ii)(7)
- .TextFrame.AutoSize = Arr(ii)(8)
- .TextFrame.WordWrap = Arr(ii)(9)
- End If
- .TextFrame.AutoSize = ppAutoSizeShapeToFitText
- End With
- Next ii
-
- End Function
复制代码 |
|