'Option Explicit '------------------------------------------------------------------------------ ' オラクル(ORACLE)のデータを取得する '------------------------------------------------------------------------------ Dim DbOpenName Dim DbOpenUser Dim DbOpenpass Dim db1 Dim rs1 Dim StrSQL DbOpenName = "Provider=MSDAORA;" DbOpenName = DbOpenName & "Data Source=データソース" DbOpenUser = "ユーザID" DbOpenpass = "パスワード" Set db1 = CreateObject("ADODB.Connection") Set rs1 = CreateObject("ADODB.Recordset") '--- db1.Open DbOpenName,DbOpenUser,DbOpenpass '--- 実行したいSQLを記述 StrSQL = " SELECT" StrSQL = StrSQL & " *" StrSQL = StrSQL & " FROM" StrSQL = StrSQL & " **********" StrSQL = StrSQL & " WHERE" StrSQL = StrSQL & " ***** = '*********' " rs1.open StrSQL,db1,1,1,adCmdText Do While not rs1.EOF msgbox "***** = [" & rs1("項目名") & "]" rs1.MoveNext Loop db1.close Set db1 = Nothing