VBA笔记系列

整表复制粘贴-->清空内存

Sheet1.Copy after:=Sheet1

Application.CutCopyMode = False

新建sheet

Sheets.Add After:=Worksheets(sheet_start)

字典:

Set d = CreateObject("Scripting.Dictionary")

d.removeall ''''清空字典

If d.Exists(arr(x, 1)) Then  '''判断键是否已经存在

数组整体粘贴:

Range("a1").Resize(行,列) = 数组名

VBA遍历文件夹

Set fs = CreateObject("Scripting.FileSystemObject")

Set f = fs.GetFolder(path)

For Each fd In f.Files
For Each fd In f.subfolders

关闭警告

关闭警告(包括替换同名文件,含有个人信息等)
Application.DisplayAlerts = False
Application.ScreenUpdating = False

闭除本文件外的所有excel:

if Workbooks.Count > 1 then
    For x = Workbooks.Count To 1 Step -1
        wb = Windows(x).Caption
        If wb <> ThisWorkbook.Name Then
            Workbooks(wb).Close False
        End If
    Next
end if

排序:

Range(Cells(321, c_to), Cells(i, c_to)).Sort _
    key1:=Columns(c_to), _
    Order1:=xlDescending, _
    Header:=xlNo

数组赋值


arr=Sheet3.Range("D7:D9")

32位变64位  申明:

declare PtrSafe sub

PPT页面内容读取

Set f = ThisWorkbook.Sheets(2)
f.Cells(1, 1) = "页码"
f.Cells(1, 2) = "顺序"
f.Cells(1, 3) = "类型"
f.Cells(1, 4) = "内容"
i = 2
j = 1
c = ppt.Presentations(1).Slides.Count
For c2 = 1 To c
    Set s1 = ppt.Presentations(1).Slides(c2)
    f.Cells(i, 1) = j
    j = j + 1
    k = 1
    For Each sh In s1.Shapes
        f.Cells(i, 2) = k
        f.Cells(i, 3) = sh.Type
        f.Cells(i, 6) = sh.Name


        If sh.HasTextFrame Then
'            f.Cells(i, 4) = sh.TextEffect.Text
        End If

        If sh.HasTable Then
            f.Cells(i, 5) = sh.Table.Columns.Count
            f.Cells(i, 4) = sh.Table.Rows.Count
        End If

        If sh.Type = 3 Then
'            f.Cells(i, 4) = sh.Chart.ChartData.Workbook.Sheets(1).Columns.Count
        End If

        i = i + 1
        k = k + 1
    Next
Next
ppt.Quit
End Sub

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值