Sub クエリをテキスト出力する() Dim dbs As Database Dim intCount As Integer Dim QDF As QueryDef Open “c:\temp\export_query.txt" For Output As #1 Set dbs = CurrentDb For intCount = 0 To dbs.QueryDefs.Count – 1 Set QDF = dbs.QueryDefs(intCount) Print #1, QDF.Name Print #1, QDF.SQL 'Debug.Print QDF.SQL Next Close End Sub