Access VBA テーブル名を一括変更するマクロ

Sub macro1()
    Dim myTable As TableDef
    For Each myTable In CurrentDb.TableDefs
    
        If Left(myTable.Name, 7) = "public_" Then
            Debug.Print myTable.Name  ' デバグ用出力
            Debug.Print "  " & Mid(myTable.Name, 8, Len(myTable.Name))  ' デバグ用出力
            myTable.Name = Mid(myTable.Name, 8, Len(myTable.Name))
        End If
    
    Next

End Sub
カテゴリ: