Microsoft Access2010 を起動した。前回は Access2003 だったから、単純に引いて 7年ぶり‥‥ ぐらい。リボン形式に変わっており、前に進めない...
組んだシステムの内容も全く忘れている。どこに何があるのかさっぱりわからない。そこで、オブジェクトの一覧を作るモジュールから挑戦した。
■ 参考サイト) Access Tips by pPoy
上記サイトを参考(首っ引き)に、オブジェクトを CSVファイルに書き出すモジュールに四苦八苦した。先が思いやられる...
- '概要:オブジェクト(テーブル、クエリー、フォーム、レポート、マクロ、モジュール)一覧をCSV出力する。
- Sub writeAllModules()
- Dim obj As AccessObject, dbs As Object
- Dim dsn As Long
- Dim strPath As String, strFile As String, strCSVFile As String
- strPath = Application.CurrentProject.Path
- strFile = Application.CurrentProject.Name
- strCSVFile = Left(strFile, InStrRev(strFile, ".")) & "csv"
- dsn = FreeFile
- Open strPath & "\" & strCSVFile For Output As #dsn
- Set dbs = Application.CurrentData
- 'AllTables コレクションから検索
- For Each obj In dbs.AllTables
- If Left(obj.Name, 4) <> "MSys" Then
- Write #dsn, strPath, strFile, "テーブル", obj.Name
- End If
- Next obj
- 'AllQueries コレクションから検索
- For Each obj In dbs.AllQueries
- Write #dsn, strPath, strFile, "クエリー", obj.Name
- Next obj
- Set dbs = Nothing
- '
- Set dbs = Application.CurrentProject
- 'AllForms コレクションから検索
- For Each obj In dbs.AllForms
- Write #dsn, strPath, strFile, "フォーム", obj.Name
- Next obj
- 'AllReports コレクションから検索
- For Each obj In dbs.AllReports
- Write #dsn, strPath, strFile, "レポート", obj.Name
- Next obj
- 'AllMacros コレクションから検索
- For Each obj In dbs.AllMacros
- Write #dsn, strPath, strFile, "マクロ", obj.Name
- Next obj
- 'AllModules コレクションから検索
- For Each obj In dbs.AllModules
- Write #dsn, strPath, strFile, "モジュール", obj.Name
- Next obj
- Set dbs = Nothing
- Close #dsn
- End Sub