zoukankan      html  css  js  c++  java
  • 获取文件夹下所有文件2

    '-------------------------------------------
    'フォルダーのオールエクセルファイルを取得して、
    'ファイル名を変更し、シート名を変更する
    '-------------------------------------------
    Sub getExcelFile()

    Application.ScreenUpdating = False

    Dim sFolderPath As String
    Dim f As String
    Dim file() As String
    Dim sheets_count As Integer
    Dim sheet_name, new_sheet_name, old_str, new_str As String


    sFolderPath = "C:Usersofu1DesktopA帳票設計書修正設計書_SRA16"
    old_str = "A16"
    new_str = "A03"


    ReDim file(1)

    file(1) = sFolderPath & ""

    f = Dir(file(1) & "*.xls")
    f = Dir

    Do While f <> ""

    Workbooks.Open Filename:=sFolderPath & "" & f
    With ActiveWorkbook
    sheets_count = .Sheets.Count
    For i = 1 To sheets_count
    sheet_name = Sheets(i).Name
    new_sheet_name = Replace(sheet_name, old_str, new_str)
    Sheets(i).Name = new_sheet_name

    Next i
    End With
    ActiveWorkbook.Close SaveChanges:=True
    f = Dir
    Loop

    End Sub

  • 相关阅读:
    Session cookie 原理
    asp.net core service mesh
    js 常用库
    asp.net core consul
    asp.net core polly
    asp.net core ocelot
    第十五章 享元模式 Flyweight
    第十四章 策略模式 Strategy
    mysql 主从复制
    mysql 执行计划
  • 原文地址:https://www.cnblogs.com/zerotomax/p/6678904.html
Copyright © 2011-2022 走看看