ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 194|回复: 3

Ppt的-214188160(80048240)错误。

[复制链接]

TA的精华主题

TA的得分主题

发表于 2024-2-18 14:14 | 显示全部楼层 |阅读模式


Set Sld = Slds("A")不成立。
image.png



  1.    Dim Pres As Presentation, Slds As Slides
  2.       Set Pres = Application.ActivePresentation
  3.       Set Slds = Pres.Slides
  4.    Dim Sld As Slide
  5.        For ii = 1 To Slds.Count
  6.            Set Sld = Slds(ii)
  7.            Sld.Name = "A" & ii
  8.            Debug.Print Sld.Name
  9.        Next ii
  10.        Set Sld = Slds("A1") ''成立
  11.        Stop
  12.        Set Sld = Slds("A")
复制代码


image.png

---------------------------------------------------------------


TA的精华主题

TA的得分主题

 楼主| 发表于 2024-2-20 10:16 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
自己出题自己做PPT的题。


  1. Sub ll()
  2.    Dim Pres As Presentation
  3.        Set Pres = Application.ActivePresentation
  4.    Dim Slds As Slides, Sld As Slide
  5.        Set Slds = Pres.Slides
  6.    Dim Shp As Shape
  7.        For ii = 1 To Slds.Count
  8.            With Slds(ii)
  9.                 Set Shp = .Shapes(2)
  10.                 Debug.Print Shp.Name, Shp.TextFrame.TextRange.Text
  11.                 Shp.Name = "MainNote"

  12.                
  13.                 Set Shp = .Shapes.AddTextbox(1, 5, 750, 300, 20)
  14.                 Shp.TextFrame.TextRange.Text = "2024年02月10日星期六 出发8:29,结束21:02,香港行12:32。"

  15.                 Shp.Name = "LeftNote"
  16.                 With Shp.TextFrame.TextRange
  17.                      .Font.Size = 15
  18.                      .Font.Bold = msoCTrue
  19.                 End With
  20.                

  21.            End With
  22.        Next ii
  23. End Sub
  24. ''
  25. Sub ll1()
  26.    Dim Pres As Presentation
  27.        Set Pres = Application.ActivePresentation
  28.    Dim Slds As Slides, Sld As Slide
  29.        Set Slds = Pres.Slides
  30.    Dim Shp As Shape
  31.        For ii = 1 To Slds.Count
  32.            With Slds(ii)
  33.                 Set Shp = .Shapes("LeftNote")
  34.                 With Shp
  35.                       .Width = 540
  36.                       .Left = 0
  37.                       .Top = 750
  38.                       .TextEffect.Alignment = msoTextEffectAlignmentRight
  39.                       With .TextFrame.TextRange
  40.                             .Font.Size = 15
  41.                             .Font.Bold = msoCTrue
  42.                             .Text = "2024年02月10日星期六 出发8:29,结束21:02,香港行历时12:32。"
  43.                      
  44.                       End With
  45.                      
  46.                 End With

  47.                 With Shp.TextFrame.TextRange
  48.                      
  49.                 End With
  50.                

  51.            End With
  52.        Next ii
  53. End Sub
复制代码

TA的精华主题

TA的得分主题

 楼主| 发表于 2024-2-28 18:04 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
自己出题自己做题

  1. Private Sub ll()
  2.     Dim Pres As Presentation
  3.         Set Pres = Application.ActivePresentation
  4.     Dim Sld As Slide, Slds As Slides
  5.         Set Slds = Pres.Slides
  6.         For ii = 1 To Slds.Count
  7.              Debug.Print Slds(ii).Name, Slds(ii).Shapes(1).Name
  8.         
  9.         Next iia
  10. End Sub
复制代码

TA的精华主题

TA的得分主题

 楼主| 发表于 2024-3-2 18:27 | 显示全部楼层
自己出题自己做


  1. '''
  2. Sub DictPptSingsDelFile()
  3.     Dim T: T = Time
  4.     Dim Fso As FileSystemObject, oFolder As Folder, oFile As File
  5.         Set Fso = New FileSystemObject
  6.     Debug.Print Format(T, "h;mm:ss")
  7.     Dim RngDic As Dictionary, SldDic As Dictionary
  8.     Dim FileRng As Range, FileDic As Dictionary
  9.         Set RngDic = New Dictionary
  10.         Set SldDic = New Dictionary
  11.         Set FileDic = New Dictionary
  12.     Dim Rng As Range, Sht As Worksheet
  13.         Set Rng = Selection
  14.         Set Sht = Rng.Parent
  15.         Set Rng = Sht.Cells(20, 1).CurrentRegion
  16.         Rng.Resize(Rng.Rows.Count, 26).Interior.Color = vbRed
  17.         
  18.         Rng.Resize(Rng.Rows.Count, 26).Interior.ColorIndex = xlNone
  19.      Dim PathName, oPath, Str
  20.      Dim Pres As Presentation, Slds As Slides
  21.      Dim Hor As Boolean
  22.          Hor = False
  23.          ''
  24.          If Hor = True Then
  25.               PathName = ThisWorkbook.Path & "" & Sht.Name & "\Hor" & Sht.Name & ".Ppt"
  26.          ElseIf Hor = False Then
  27.               PathName = ThisWorkbook.Path & "" & Sht.Name & "\Ver" & Sht.Name & ".Ppt"
  28.          End If
  29.          
  30.          Debug.Print PathName
  31.          oPath = ThisWorkbook.Path & "" & Sht.Name
  32.          
  33.          Set oFolder = Fso.GetFolder(oPath)
  34.          Set oFiles = oFolder.Files
  35.          Set Pres = OpenPpt(PathName)
  36.          Set Slds = Pres.Slides
  37.     Dim Arr, Rr, ii, jj
  38.     Dim Sld As Slide

  39.             For Each Sld In Slds
  40.                Sld.Name = Sld.Shapes(1).Name
  41.                SldDic(UCase(Sld.Name)) = ""                   ''
  42.             Next Sld
  43.             '''
  44.             For Each oFile In oFiles
  45.                 If InStr(UCase(oFile.Name), "JPG") > 0 Then
  46.                     'Debug.Print oFile.Name
  47.                     FileDic(oFile.Name) = ""
  48.                     Debug.Print oFile.Path
  49.                 End If
  50.             Next oFile
  51.             '''
  52.             Kk = 1
  53.             Set Rng = Sht.Cells(Rng.Row + Rng.Rows.Count + 20, 1).Resize(1000, 10)
  54.             '''
  55.             Rng.Clear
  56.             For ii = 0 To FileDic.Count - 1
  57.                  Str = UCase(FileDic.Keys(ii))
  58.                  'Str = Mid(Str, 2, 100)
  59.                  If Not SldDic.Exists(Str) Then
  60.                     Sht.Cells(Rng.Row + Kk, 1) = Kk
  61.                     Sht.Cells(Rng.Row + Kk, 2) = Str
  62.                     Str = ThisWorkbook.Path & "" & Sht.Name & "" & FileDic.Keys(ii)
  63.                     
  64.                     Set oFile = Fso.GetFile(Str)
  65.                     oFile.Move "D:\Tmp"
  66.                     Kk = Kk + 1
  67.                  End If
  68.             Next ii
  69.             '''
  70.             'Set oRng = Sht.Cells(Rng.Row + Rng.Rows.Count + Kk - 10, 1).CurrentRegion
  71.             Debug.Print Sht.Cells(Rng.Row - 5, 1).Address, Kk

  72.             Sht.Cells(Rng.Row - 5, 1) = "=count(" & Rng.Resize(Kk + 2, 1).Address(0, 0) & ")"
  73.             
  74.         Debug.Print Format(Time - T, "h;mm:ss")
  75.         'Pres.Save
  76.         Debug.Print Format(Time - T, "h;mm:ss")
  77. End Sub
  78. ''
  79. '''''''

复制代码
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-5-22 14:12 , Processed in 0.029738 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表