{"id":6148,"date":"2017-09-19T14:50:21","date_gmt":"2017-09-19T05:50:21","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=6148"},"modified":"2017-10-23T12:53:16","modified_gmt":"2017-10-23T03:53:16","slug":"adocommand","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/adocommand\/","title":{"rendered":"\u30af\u30a8\u30ea\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3057\u3066\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\uff08ADO\uff09Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30fbExecute \u30e1\u30bd\u30c3\u30c9"},"content":{"rendered":"<h2>\u30af\u30a8\u30ea\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3057\u3066\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\u624b\u9806<\/h2>\n<div class=\"m30-l\">\n<ol>\n<li><a href=\"#command\">Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/a>\u306e\u4f5c\u6210<\/li>\n<li><a href=\"#activeconnection\">ActiveConnection \u30d7\u30ed\u30d1\u30c6\u30a3<\/a>\u3092\u4f7f\u3044\u3001\u958b\u3044\u3066\u3044\u308b\u63a5\u7d9a\uff08Connection \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09\u3068 Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3092\u95a2\u9023\u4ed8\u3051\u308b\u3002\u307e\u305f\u306f\u3001ActiveConnection \u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u6709\u52b9\u306a\u63a5\u7d9a\u6587\u5b57\u5217\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/li>\n<li><a href=\"#commandtext\">CommandText \u30d7\u30ed\u30d1\u30c6\u30a3<\/a>\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5fc5\u8981\u306a\u30af\u30a8\u30ea\u3092\u8a2d\u5b9a\u3059\u308b\u3002\u307e\u305f\u306f\u3001SQL\u6587\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/li>\n<li><a href=\"#parameters\">Parameters \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/a>\u3092\u4f7f\u3044\u3001\u30af\u30a8\u30ea\u306b\u6e21\u3059\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u914d\u5217\u5f62\u5f0f\u3067\u6307\u5b9a\u3059\u308b\u3002<\/li>\n<li><a href=\"#execute\">Execute \u30e1\u30bd\u30c3\u30c9<\/a>\u3092\u5b9f\u884c\u3057\u3001\u5fc5\u8981\u3067\u3042\u308c\u3070 Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8fd4\u3059\u3002<\/li>\n<\/ol>\n<h3 id=\"command\">Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08\u53c2\u7167\u8a2d\u5b9a\uff09<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <strong>Dim<\/strong> <em>cmd<\/em> <strong>As<\/strong> <strong>ADODB.Command<\/strong><br \/>\n    <strong>Set<\/strong> <em>cmd<\/em> = <strong>New<\/strong> <strong>ADODB.Command<\/strong><\/p>\n<div class=\"m60-l\">\u307e\u305f\u306f<\/div>\n<p><\/p>\n<p>    <strong>Dim<\/strong> <em>cmd<\/em> <strong>As New<\/strong> <strong>ADODB.Command<\/strong><\/p><\/div>\n<br \/>\n<h4>\u53c2\u7167\u8a2d\u5b9a\u3092\u884c\u3046\u30e9\u30a4\u30d6\u30e9\u30ea\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066<\/h4>\n<div class=\"m30-l\">\n<p class=\"caution4\">Excel2003 \u4ee5\u524d\u3067\u306f\u3001<strong>Microsoft ActiveX Data Objects 2.8 Library<\/strong> \u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n      Excel2007 \u4ee5\u964d\u3067\u306f\u3001<strong>Microsoft ActiveX Data Objects \u30d0\u30fc\u30b8\u30e7\u30f3\u756a\u53f7 Library<\/strong> \u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n      \u203b \u8907\u6570\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u3042\u308a\u307e\u3059\u3002\u7279\u306b\u5fc5\u8981\u304c\u306a\u3051\u308c\u3070\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u9078\u629e\u3059\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p class=\"caution4\">\u53c2\u7167\u8a2d\u5b9a\u306e\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/filesystemobject\/\">\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08FileSystemObject\uff09\u306e\u4f7f\u3044\u65b9<\/a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<\/p><\/div>\n<br \/><br \/>\n<h3>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08CreateObject \u95a2\u6570\uff09<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <strong>Dim<\/strong> <em>cmd<\/em> <strong>As object<\/strong><br \/>\n    <strong>Set<\/strong> <em>cmd<\/em> = <strong>CreateObject<\/strong>(&#8220;<strong>ADODB.Command<\/strong>&#8220;)<\/p><\/div>\n<br \/>\n<h4>CreateObject \u95a2\u6570<\/h4>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>CreatObject \u95a2\u6570<\/strong> \u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u53c2\u7167\u8a2d\u5b9a\u306e\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001VBE \u3067\u3001\u81ea\u52d5\u30e1\u30f3\u30d0\u8868\u793a\u7b49\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u652f\u63f4\u6a5f\u80fd\u304c\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002\u307e\u305f\u3001\u30de\u30af\u30ed\u306e\u5b9f\u884c\u901f\u5ea6\u3082\u9045\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<\/p><\/div>\n<br \/><br \/>\n<h3 id=\"activeconnection\">ActiveConnection \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>ActiveConnection<\/strong> = <em>Connection_object<\/em><\/p>\n<div class=\"m60-l\">\u307e\u305f\u306f<\/div>\n<p><\/p>\n<p>    <em>object<\/em>.<strong>ActiveConnection<\/strong> = <em>ConnectionString<\/em><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>Connection_object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>Connection \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u8a73\u7d30\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/databaseadobase\/\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\uff08Access \u7b49\uff09\u306b\u63a5\u7d9a\uff08ADO\uff09<\/a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<li>ConnectionString&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u63a5\u7d9a\u60c5\u5831\u6587\u5b57\u5217\uff08String\uff09\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u8a73\u7d30\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/databaseadobase\/\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\uff08Access \u7b49\uff09\u306b\u63a5\u7d9a\uff08ADO\uff09<\/a> \u306e <strong>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u63a5\u7d9a\uff08Open \u30e1\u30bd\u30c3\u30c9\uff09<\/strong> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<p class=\"caution4\"><strong>ActiveConnection \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\u306b <strong>Nothing<\/strong> \u3092\u8a2d\u5b9a\u3059\u308b\u3068\u3001<strong>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u3068\u73fe\u5728\u306e <strong>Connection<\/strong> \u3068\u306e\u95a2\u9023\u4ed8\u3051\u304c\u89e3\u9664\u3055\u308c\u3001\u30d7\u30ed\u30d0\u30a4\u30c0\u306f\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u4e0a\u306e\u95a2\u9023\u3059\u308b\u30ea\u30bd\u30fc\u30b9\u3092\u3059\u3079\u3066\u89e3\u653e\u3057\u307e\u3059\u3002<\/p>\n<br \/><br \/>\n<h3 id=\"commandtext\">CommandText \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>CommandText<\/strong> = <em>Source<\/em><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>Source&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30c6\u30fc\u30d6\u30eb\u540d\u3001\u30af\u30a8\u30ea\u3001SQL\u6587\u306a\u3069\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<p class=\"caution4\"><strong>CommandText \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong> \u306b\u306f\u3001SQL \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3001\u30c6\u30fc\u30d6\u30eb\u540d\u3001\u307e\u305f\u306f\u30b9\u30c8\u30a2\u30c9\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306e\u547c\u3073\u51fa\u3057\u306a\u3069\u3092\u8868\u3059\u6587\u5b57\u5217\u578b\uff08String\uff09\u306e\u5024\u3092\u8a2d\u5b9a\u307e\u305f\u306f\u53d6\u5f97\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f &#8220;&#8221;\uff08\u9577\u3055 0 \u306e\u6587\u5b57\u5217\uff09\u3067\u3059\u3002<\/p>\n<p class=\"caution4\">\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408\u306f\u3001<strong>\u30af\u30a8\u30ea\u540d<\/strong> \u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30d1\u30e9\u30e1\u30fc\u30bf\u30af\u30a8\u30ea\u306e\u5834\u5408\u306f\u3001<strong>Parameters \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/strong> \u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<br \/><br \/>\n<h3 id=\"commandtype\">CommandType \u30d7\u30ed\u30d1\u30c6\u30a3<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>CommandType<\/strong> = <em>commandtypeenum<\/em><\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>commandtypeenum&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>CommandTypeEnum \u5024<\/strong>\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u5024\u306e\u53d6\u5f97\u3082\u53ef\u80fd\u3067\u3059\u3002<br \/>\n<table>\n<tr>\n<td align = \"center\" width=\"200\" bgcolor=\"#ffffccc\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align = \"center\" width=\"50\" bgcolor=\"#ffffccc\"><strong>\u5024<\/strong><\/td>\n<td align = \"center\" width=\"400\" bgcolor=\"#ffffccc\"><strong>\u5185\u5bb9<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdText<\/td>\n<td width=\"50\" align = \"center\">1<\/td>\n<td width=\"400\">SQL \u6587<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdTable<\/td>\n<td width=\"50\" align = \"center\">2<\/td>\n<td width=\"400\">\u30c6\u30fc\u30d6\u30eb\u540d<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdStoredProc<\/td>\n<td width=\"50\" align = \"center\">4<\/td>\n<td width=\"400\">\u30b9\u30c8\u30a2\u30c9 \u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u540d<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdUnknown<\/td>\n<td width=\"50\" align = \"center\">8<\/td>\n<td width=\"400\">\u4e0d\u660e\uff08\u65e2\u5b9a\u5024\uff09<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdFile<\/td>\n<td width=\"50\" align = \"center\">256<\/td>\n<td width=\"400\">\u6c38\u7d9a\u7684\u306b\u4fdd\u5b58\u3055\u308c\u305f Recordset \u306e\u30d5\u30a1\u30a4\u30eb\u540d<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdTableDirect<\/td>\n<td width=\"50\" align = \"center\">512<\/td>\n<td width=\"400\">\u5217\u304c\u3059\u3079\u3066\u8fd4\u3055\u308c\u308b\u30c6\u30fc\u30d6\u30eb\u540d<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdUnspecified<\/td>\n<td width=\"50\" align = \"center\">-1<\/td>\n<td width=\"400\">\u30b3\u30de\u30f3\u30c9\u30bf\u30a4\u30d7\u5f15\u6570\u3092\u6307\u5b9a\u3057\u307e\u305b\u3093<\/td>\n<\/tr>\n<\/table>\n<p>\n      <\/li>\n<\/ul><\/div>\n<br \/><br \/>\n<h3 id=\"parameters\">Parameters \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>Parameters<\/strong> = <strong>Array<\/strong> ( <em>parameters_strings<\/em> )<\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>parameters_string&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30af\u30a8\u30ea\u306b\u6e21\u3059\u30d1\u30e9\u30e1\u30fc\u30bf\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u8907\u6570\u3042\u308b\u5834\u5408\u306f,\uff08\u30ab\u30f3\u30de\uff09\u3067\u533a\u5207\u308a\u307e\u3059\u3002<\/li>\n<li>FieldName&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30af\u30a8\u30ea\u306b\u6e21\u3059\u30d1\u30e9\u30e1\u30fc\u30bf\u6587\u5b57\u5217\u306e\u5217\u540d\uff08\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\uff09\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>parameter_string&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30af\u30a8\u30ea\u306b\u6e21\u3059 <em>FieldName<\/em> \u306b\u5bfe\u5fdc\u3059\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>Item \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong><br \/>\n      <a href=\"#parameter\">Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n    <\/p>\n<\/p><\/div>\n<br \/>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>Count \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong><\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><br \/>\n\t<strong>Parameters<\/strong>.<strong>Count<\/strong>\n      <\/div>\n<\/p>\n<p>    <strong>\u623b\u308a\u5024\uff1a<\/strong>\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6570\u3092\u8868\u3059\u9577\u6574\u6570\u578b\uff08Long\uff09\u306e\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002\n  <\/div>\n<br \/>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>Append \u30e1\u30bd\u30c3\u30c9<\/strong><\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><br \/>\n\t<strong>Parameters<\/strong>.<strong>Append<\/strong> <em>param_object<\/em>\n      <\/div>\n<\/p>\n<p>    <strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u3092 <strong>Parameters \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/strong>\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u306f\u3001<strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e <strong>Type \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n    <strong>\u3010\u5f15\u6570\u3011<\/strong><br \/>\n    \u30fb<strong>param_object<\/strong>\u30fb\u30fb\u30fb<strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong> \u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\uff08<a href=\"#createparameter\">CreateParameter \u30e1\u30bd\u30c3\u30c9<\/a>\u306e\u623b\u308a\u5024\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\uff09\n  <\/div>\n<br \/>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>Delete \u30e1\u30bd\u30c3\u30c9<\/strong><\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><br \/>\n\t<strong>Parameters<\/strong>.<strong>Delete<\/strong> <em>Index<\/em>\n      <\/div>\n<\/p>\n<p>    <strong>Parameters \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/strong>\u304b\u3089\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u524a\u9664\u3057\u307e\u3059\u3002<br \/>\n    <strong>\u3010\u5f15\u6570\u3011<\/strong><br \/>\n    \u30fb<strong>Index<\/strong>\u30fb\u30fb\u30fb<strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong> \u306e <strong>Name \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\u3001\u307e\u305f\u306f <strong>Parameters \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/strong>\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u5024\uff08\u6574\u6570\u5024\uff1a 0 \uff5e Parameters.Count &#8211; 1 \uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\n  <\/div>\n<br \/>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>Refresh \u30e1\u30bd\u30c3\u30c9<\/strong><\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><br \/>\n\t<strong>Parameters<\/strong>.<strong>Refresh<\/strong>\n      <\/div>\n<p>      <strong>Parameters.Refresh \u30e1\u30bd\u30c3\u30c9<\/strong>\u3092\u4f7f\u3046\u3068\u3001Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u6307\u5b9a\u3055\u308c\u305f\u30b9\u30c8\u30a2\u30c9\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u307e\u305f\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u30af\u30a8\u30ea\u306b\u95a2\u3059\u308b\u30d7\u30ed\u30d0\u30a4\u30c0\u5074\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\u30d7\u30ed\u30d0\u30a4\u30c0\u304c\u30b9\u30c8\u30a2\u30c9\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306e\u547c\u3073\u51fa\u3057\u307e\u305f\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u30af\u30a8\u30ea\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u306a\u3044\u5834\u5408\u306f\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u7a7a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Parameters.Refres \u30e1\u30bd\u30c3\u30c9 \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n    \r\nSub Sample_Command_Refresh()\r\n\r\n    '\u53c2\u7167\u8a2d\u5b9a:Microsoft ActiveX Data Objects 6.1 Library\r\n\r\n    Dim cmd As ADODB.Command\r\n    Dim rs As Object\r\n    Dim constr As String\r\n    Dim DBFile As String\r\n    \r\n    DBFile = ActiveWorkbook.Path & \"\\mydb1.accdb\"\r\n    constr = \"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" & DBFile\r\n                \r\n    Set cmd = New ADODB.Command\r\n    cmd.ActiveConnection = constr\r\n    \r\n    cmd.CommandText = \"[\u30c6\u30fc\u30d6\u30eb2 \u30af\u30a8\u30ea]\"\r\n    Set rs = cmd.Execute(Parameters:=Array(1))\r\n    \r\n    cmd.Parameters.Refresh\r\n    \r\n    cmd.CommandText = \"[\u30c6\u30fc\u30d6\u30eb3 \u30af\u30a8\u30ea1]\"\r\n    Set rs = cmd.Execute(Parameters:=Array(1100, 2000, 2010, 3))\r\n        \r\n    rs.Close\r\n    Set rs = Nothing\r\n    Set cmd = Nothing\r\n    \r\nEnd Sub\r\n    \r\n    <\/pre>\n<p>    <br \/><br \/>\n    \u203b \u4e0a\u8a18\u306e\u5834\u5408\u3001Parameters.Refresh \u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u884c\u3057\u306a\u3044\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n    <a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_05.jpg?ssl=1\" rel=\"lightbox[6148]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_05.jpg?resize=427%2C194&#038;ssl=1\" alt=\"Parameters.Refresh \u30a8\u30e9\u30fc\" width=\"427\" height=\"194\" class=\"alignnone size-full wp-image-6168\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_05.jpg?w=427&amp;ssl=1 427w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_05.jpg?resize=400%2C182&amp;ssl=1 400w\" sizes=\"(max-width: 427px) 100vw, 427px\" data-recalc-dims=\"1\" \/><\/a><\/p><\/div>\n<br \/><br \/>\n<h3 id=\"createparameter\">CreateParameter \u30e1\u30bd\u30c3\u30c9<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1cParameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\uff1e<\/strong><\/span><br \/>\n    <strong>Set<\/strong> <em>parameter<\/em> = <em>object<\/em>.<strong>CreateParameter<\/strong> ( <em>Name<\/em>[, <em>Type<\/em>, <em>Direction<\/em>, <em>Size<\/em>, <em>Value<\/em>] )<\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>Name&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u540d\u524d\u3092\u8868\u3059\u6587\u5b57\u5217\u578b\uff08String\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>Type&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u30c7\u30fc\u30bf\u578b\u3092\u8868\u3059 <strong>DataTypeEnum \u30af\u30e9\u30b9<\/strong>\u306e\u5b9a\u6570\u307e\u305f\u306f\u5024\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<br \/>\n<table>\n<tr>\n<td align = \"center\" width=\"200\" bgcolor=\"#fffccc\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align = \"center\" width=\"50\" bgcolor=\"#fffccc\"><strong>\u5024<\/strong><\/td>\n<td align = \"center\" width=\"400\" bgcolor=\"#fffccc\"><strong>\u8aac\u660e<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adEmpty<\/td>\n<td align = \"center\" width=\"50\">0<\/td>\n<td width=\"400\">\u6307\u5b9a\u3055\u308c\u305f\u5024\u306a\u3057<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adSmallInt<\/td>\n<td align = \"center\" width=\"50\">2<\/td>\n<td width=\"400\">2 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u4ed8\u304d\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adInteger<\/td>\n<td align = \"center\" width=\"50\">3<\/td>\n<td width=\"400\">4 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u4ed8\u304d\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adSingle<\/td>\n<td align = \"center\" width=\"50\">4<\/td>\n<td width=\"400\">\u5358\u7cbe\u5ea6\u6d6e\u52d5\u5c0f\u6570\u70b9\u5024<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adDouble<\/td>\n<td align = \"center\" width=\"50\">5<\/td>\n<td width=\"400\">\u500d\u7cbe\u5ea6\u6d6e\u52d5\u5c0f\u6570\u70b9\u5024<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCurrency<\/td>\n<td align = \"center\" width=\"50\">6<\/td>\n<td width=\"400\">\u901a\u8ca8\u5024 (8 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u4ed8\u304d\u6574\u6570\u3001\u6841\u6570 10,000)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adDate<\/td>\n<td align = \"center\" width=\"50\">7<\/td>\n<td width=\"400\">\u65e5\u4ed8\u578b (Date) \u5024<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adBSTR<\/td>\n<td align = \"center\" width=\"50\">8<\/td>\n<td width=\"400\">\u7d42\u7aef\u304c null \u306e\u6587\u5b57\u5217 (Unicode)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adIDispatch<\/td>\n<td align = \"center\" width=\"50\">9<\/td>\n<td width=\"400\">OLE \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e IDispatch \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3092\u6307\u3059\u30dd\u30a4\u30f3\u30bf<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adError<\/td>\n<td align = \"center\" width=\"50\">10<\/td>\n<td width=\"400\">32 \u30d3\u30c3\u30c8\u306e\u30a8\u30e9\u30fc \u30b3\u30fc\u30c9<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adBoolean<\/td>\n<td align = \"center\" width=\"50\">11<\/td>\n<td width=\"400\">\u30d6\u30fc\u30eb\u578b (Boolean) \u5024<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adVariant<\/td>\n<td align = \"center\" width=\"50\">12<\/td>\n<td width=\"400\">OLE \u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3 \u30d0\u30ea\u30a2\u30f3\u30c8\u578b (Variant)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adIUnknown<\/td>\n<td align = \"center\" width=\"50\">13<\/td>\n<td width=\"400\">OLE \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e IUnknown \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3092\u6307\u3059\u30dd\u30a4\u30f3\u30bf<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adDecimal<\/td>\n<td align = \"center\" width=\"50\">14<\/td>\n<td width=\"400\">\u56fa\u5b9a\u306e\u7cbe\u5ea6\u304a\u3088\u3073\u6841\u6570\u3092\u6301\u3064\u6b63\u78ba\u306a\u6570\u5024<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adTinyInt<\/td>\n<td align = \"center\" width=\"50\">16<\/td>\n<td width=\"400\">1 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u4ed8\u304d\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adUnsignedTinyInt<\/td>\n<td align = \"center\" width=\"50\">17<\/td>\n<td width=\"400\">1 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u306a\u3057\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adUnsignedSmallInt<\/td>\n<td align = \"center\" width=\"50\">18<\/td>\n<td width=\"400\">2 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u306a\u3057\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adUnsignedInt<\/td>\n<td align = \"center\" width=\"50\">19<\/td>\n<td width=\"400\">4 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u306a\u3057\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adBigInt<\/td>\n<td align = \"center\" width=\"50\">20<\/td>\n<td width=\"400\">8 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u4ed8\u304d\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adUnsignedBigInt<\/td>\n<td align = \"center\" width=\"50\">21<\/td>\n<td width=\"400\">8 \u30d0\u30a4\u30c8\u306e\u7b26\u53f7\u306a\u3057\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adGUID<\/td>\n<td align = \"center\" width=\"50\">72<\/td>\n<td width=\"400\">\u30b0\u30ed\u30fc\u30d0\u30eb\u4e00\u610f\u8b58\u5225\u5b50 (GUID)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adBinary<\/td>\n<td align = \"center\" width=\"50\">128<\/td>\n<td width=\"400\">\u30d0\u30a4\u30ca\u30ea\u5024<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adChar<\/td>\n<td align = \"center\" width=\"50\">129<\/td>\n<td width=\"400\">\u6587\u5b57\u5217\u578b (String) \u5024<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adWChar<\/td>\n<td align = \"center\" width=\"50\">130<\/td>\n<td width=\"400\">\u7d42\u7aef\u304c null \u306e Unicode \u6587\u5b57\u5217<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adNumeric<\/td>\n<td align = \"center\" width=\"50\">131<\/td>\n<td width=\"400\">\u56fa\u5b9a\u306e\u7cbe\u5ea6\u304a\u3088\u3073\u6841\u6570\u3092\u6301\u3064\u6b63\u78ba\u306a\u6570\u5024<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adUserDefined<\/td>\n<td align = \"center\" width=\"50\">132<\/td>\n<td width=\"400\">\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u5909\u6570<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adDBDate<\/td>\n<td align = \"center\" width=\"50\">133<\/td>\n<td width=\"400\">\u65e5\u4ed8\u5024 (yyyymmdd)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adDBTime<\/td>\n<td align = \"center\" width=\"50\">134<\/td>\n<td width=\"400\">\u6642\u523b\u5024 (hhmmss)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adDBTimeStamp<\/td>\n<td align = \"center\" width=\"50\">135<\/td>\n<td width=\"400\">\u65e5\u4ed8\u6642\u523b\u30b9\u30bf\u30f3\u30d7 (yyyymmddhhmmss \u304a\u3088\u3073 10 \u5104\u5206\u306e 1 \u6841\u307e\u3067\u306e\u5c0f\u6570)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adVarChar<\/td>\n<td align = \"center\" width=\"50\">200<\/td>\n<td width=\"400\">\u6587\u5b57\u5217\u578b (String) \u5024 (Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adLongVarChar<\/td>\n<td align = \"center\" width=\"50\">201<\/td>\n<td width=\"400\">\u9577\u6587\u5b57\u5217\u578b (String) \u5024 (Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adVarWChar<\/td>\n<td align = \"center\" width=\"50\">202<\/td>\n<td width=\"400\">\u7d42\u7aef\u304c null \u306e Unicode \u6587\u5b57\u5217 (Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adLongVarWChar<\/td>\n<td align = \"center\" width=\"50\">203<\/td>\n<td width=\"400\">\u7d42\u7aef\u304c null \u306e\u9577\u6587\u5b57\u5217\u5024 (Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adVarBinary<\/td>\n<td align = \"center\" width=\"50\">204<\/td>\n<td width=\"400\">\u30d0\u30a4\u30ca\u30ea\u5024 (Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f)<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adLongVarBinary<\/td>\n<td align = \"center\" width=\"50\">205<\/td>\n<td width=\"400\">\u30ed\u30f3\u30b0 \u30d0\u30a4\u30ca\u30ea\u5024 (Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f)<\/td>\n<\/tr>\n<\/table>\n<p>\n      <\/li>\n<li>Direction&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u578b\u3092\u8868\u3059<strong>ParameterDirectionEnum \u30af\u30e9\u30b9<\/strong>\u306e\u5b9a\u6570\u307e\u305f\u306f\u5024\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<br \/>\n<table>\n<tr>\n<td align = \"center\" width=\"200\" bgcolor=\"#ffffccc\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align = \"center\" width=\"50\" bgcolor=\"#ffffccc\"><strong>\u5024<\/strong><\/td>\n<td align = \"center\" width=\"400\" bgcolor=\"#ffffccc\"><strong>\u5185\u5bb9<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adParamUnknown<\/td>\n<td width=\"50\" align = \"center\">0<\/td>\n<td width=\"400\">\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u65b9\u5411\u304c\u4e0d\u660e<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adParamInput<\/td>\n<td width=\"50\" align = \"center\">1<\/td>\n<td width=\"400\">\u5165\u529b\u30d1\u30e9\u30e1\u30fc\u30bf\uff08\u65e2\u5b9a\u5024\uff09<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adParamOutput<\/td>\n<td width=\"50\" align = \"center\">2<\/td>\n<td width=\"400\">\u51fa\u529b\u30d1\u30e9\u30e1\u30fc\u30bf<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adParamInputOutput<\/td>\n<td width=\"50\" align = \"center\">3<\/td>\n<td width=\"400\">\u5165\u51fa\u529b\u30d1\u30e9\u30e1\u30fc\u30bf<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adParamReturnValue<\/td>\n<td width=\"50\" align = \"center\">4<\/td>\n<td width=\"400\">\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u304c\u623b\u308a\u5024\u3092\u8868\u3059<\/td>\n<\/tr>\n<\/table>\n<p>\n      <\/li>\n<li>Size&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6700\u5927\u30b5\u30a4\u30ba\u3092\u6587\u5b57\u5358\u4f4d\u307e\u305f\u306f\u30d0\u30a4\u30c8\u5358\u4f4d\u3067\u793a\u3059\u9577\u6574\u6570\u578b\uff08Long\uff09\u306e\u5024\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<\/li>\n<li>Value&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u8a2d\u5b9a\u3059\u308b\u5024\uff08\u30af\u30a8\u30ea\u306b\u6e21\u3059\u30d1\u30e9\u30e1\u30fc\u30bf\u5024\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<\/li>\n<li>parameter&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u4f5c\u6210\u3059\u308b <strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong> \u3092\u8868\u3059\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5909\u6570<\/li>\n<\/li>\n<\/ul><\/div>\n<br \/><br \/>\n<h3 id=\"execute\">Execute \u30e1\u30bd\u30c3\u30c9<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <strong>Set<\/strong> <em>recordset<\/em> = <em>object<\/em>.<strong>Execute<\/strong> [ ( <em>RecordsAffected<\/em>, <em>Parameters<\/em>, <em>Options<\/em> ) ]<\/p>\n<p>    <em>object<\/em>.<strong>Execute<\/strong> [ <em>RecordsAffected<\/em>, <em>Parameters<\/em>, <em>Options<\/em> ]<\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>recordset&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>Recordset \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u3092\u8868\u3059\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5909\u6570\u3067\u3059\u3002<strong>Execute \u30e1\u30bd\u30c3\u30c9<\/strong>\u306e\u5b9f\u884c\u7d50\u679c\u3001\u307e\u305f\u306f\u3001<strong>Nothing<\/strong> \u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/li>\n<li>RecordsAffected&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u9577\u6574\u6570\u578b\uff08Long\uff09\u306e\u5909\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<strong>Execute \u30e1\u30bd\u30c3\u30c9<\/strong>\u5b9f\u884c\u64cd\u4f5c\u306b\u3088\u3063\u3066\u5f71\u97ff\u3092\u53d7\u3051\u305f\u30ec\u30b3\u30fc\u30c9\u306e\u6570\u3092\u3053\u306e\u5909\u6570\u306b\u8fd4\u3057\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<\/li>\n<li>Parameters&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30af\u30a8\u30ea\u306b\u6e21\u3059\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30d0\u30ea\u30a2\u30f3\u30c8\u578b\uff08Variant\uff09\u306e\u914d\u5217\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<a href=\"#parameters\">\u21d2 Parameters \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/a>\uff08\u7701\u7565\u53ef\uff09<\/li>\n<li>Options&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>CommandText \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong>\u306e\u8a55\u4fa1\u3092\u6700\u9069\u5316\u3059\u308b\u305f\u3081\u306b\u4f7f\u3044\u307e\u3059\uff08\u7701\u7565\u53ef\uff09\u3002<br \/>\n\t<strong>CommandTypeEnum \u30af\u30e9\u30b9<\/strong> \u306e\u5b9a\u6570\uff08\u307e\u305f\u306f\u305d\u306e\u5024\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002&#038;<\/p>\n<table>\n<tr>\n<td align = \"center\" width=\"200\" bgcolor=\"#ffffccc\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align = \"center\" width=\"50\" bgcolor=\"#ffffccc\"><strong>\u5024<\/strong><\/td>\n<td align = \"center\" width=\"400\" bgcolor=\"#ffffccc\"><strong>\u5185\u5bb9<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdText<\/td>\n<td width=\"50\" align = \"center\">1<\/td>\n<td width=\"400\">SQL \u6587<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdTable<\/td>\n<td width=\"50\" align = \"center\">2<\/td>\n<td width=\"400\">\u30c6\u30fc\u30d6\u30eb\u540d<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdStoredProc<\/td>\n<td width=\"50\" align = \"center\">4<\/td>\n<td width=\"400\">\u30b9\u30c8\u30a2\u30c9 \u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u540d<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdUnknown<\/td>\n<td width=\"50\" align = \"center\">8<\/td>\n<td width=\"400\">\u4e0d\u660e\uff08\u65e2\u5b9a\u5024\uff09<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdFile<\/td>\n<td width=\"50\" align = \"center\">256<\/td>\n<td width=\"400\">\u6c38\u7d9a\u7684\u306b\u4fdd\u5b58\u3055\u308c\u305f Recordset \u306e\u30d5\u30a1\u30a4\u30eb\u540d<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdTableDirect<\/td>\n<td width=\"50\" align = \"center\">512<\/td>\n<td width=\"400\">\u5217\u304c\u3059\u3079\u3066\u8fd4\u3055\u308c\u308b\u30c6\u30fc\u30d6\u30eb\u540d<\/td>\n<\/tr>\n<tr>\n<td width=\"200\">adCmdUnspecified<\/td>\n<td width=\"50\" align = \"center\">-1<\/td>\n<td width=\"400\">\u30b3\u30de\u30f3\u30c9\u30bf\u30a4\u30d7\u5f15\u6570\u3092\u6307\u5b9a\u3057\u307e\u305b\u3093<\/td>\n<\/tr>\n<\/table>\n<p>\n      <\/li>\n<\/ul><\/div>\n<br \/><br \/>\n<h3 id=\"parameter_1\">Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08\u53c2\u7167\u8a2d\u5b9a\uff09<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <strong>Dim<\/strong> <em>parameter<\/em> <strong>As<\/strong> <strong>ADODB.Parameter<\/strong><br \/>\n    <strong>Set<\/strong> <em>parameter<\/em> = <strong>New<\/strong> <strong>ADODB.Parameter<\/strong><\/p>\n<div class=\"m60-l\">\u307e\u305f\u306f<\/div>\n<p><\/p>\n<p>    <strong>Dim<\/strong> <em>parameter<\/em> <strong>As New<\/strong> <strong>ADODB.Parameter<\/strong><\/p><\/div>\n<br \/>\n<h4>\u53c2\u7167\u8a2d\u5b9a\u3092\u884c\u3046\u30e9\u30a4\u30d6\u30e9\u30ea\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066<\/h4>\n<div class=\"m30-l\">\n<p class=\"caution4\">Excel2003 \u4ee5\u524d\u3067\u306f\u3001<strong>Microsoft ActiveX Data Objects 2.8 Library<\/strong> \u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n      Excel2007 \u4ee5\u964d\u3067\u306f\u3001<strong>Microsoft ActiveX Data Objects \u30d0\u30fc\u30b8\u30e7\u30f3\u756a\u53f7 Library<\/strong> \u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n      \u203b \u8907\u6570\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u3042\u308a\u307e\u3059\u3002\u7279\u306b\u5fc5\u8981\u304c\u306a\u3051\u308c\u3070\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u9078\u629e\u3059\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p class=\"caution4\">\u53c2\u7167\u8a2d\u5b9a\u306e\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/filesystemobject\/\">\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08FileSystemObject\uff09\u306e\u4f7f\u3044\u65b9<\/a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<\/p><\/div>\n<br \/><br \/>\n<h3 id=\"parameter_2\">Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08CreateObject \u95a2\u6570\uff09<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <strong>Dim<\/strong> <em>parameter<\/em> <strong>As object<\/strong><br \/>\n    <strong>Set<\/strong> <em>parameter<\/em> = <strong>CreateObject<\/strong>(&#8220;<strong>ADODB.Parameter<\/strong>&#8220;)<\/p><\/div>\n<br \/>\n<h4>CreateObject \u95a2\u6570<\/h4>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>CreatObject \u95a2\u6570<\/strong> \u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u53c2\u7167\u8a2d\u5b9a\u306e\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001VBE \u3067\u3001\u81ea\u52d5\u30e1\u30f3\u30d0\u8868\u793a\u7b49\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u652f\u63f4\u6a5f\u80fd\u304c\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002\u307e\u305f\u3001\u30de\u30af\u30ed\u306e\u5b9f\u884c\u901f\u5ea6\u3082\u9045\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<\/p><\/div>\n<br \/><br \/>\n<h3 id=\"parameter\">Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u53d6\u5f97<\/h3>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <span class=\"red\"><strong>\uff1c\u53d6\u5f97\uff1e<\/strong><\/span><br \/>\n    <em>object<\/em>.<strong>Parameters<\/strong>[.<strong>Item<\/strong>](<em>index<\/em>)<br \/>\n    <em>object<\/em>.<strong>Parameters<\/strong>[.<strong>Item<\/strong>](<em>name<\/em>)<br \/>\n    <em>object<\/em>(<em>index<\/em>)<br \/>\n    <em>object<\/em>(<em>name<\/em>)<br \/>\n    <em>object<\/em>![<em>name<\/em>]<\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b <span class=\"red\"><strong>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>index&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u756a\u53f7\uff080 \u304b\u3089\u59cb\u307e\u308b\u6574\u6570\u5024\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>name&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30d1\u30e9\u30e1\u30fc\u30bf\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>Name \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong><\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><br \/>\n\t<em>parameter_object<\/em>.<strong>Name<\/strong>\n      <\/div>\n<\/p>\n<p>    \u30d1\u30e9\u30e1\u30fc\u30bf\u540d\u306e\u53d6\u5f97\u304a\u3088\u3073\u8a2d\u5b9a\u3092\u3057\u307e\u3059\u3002<br \/>\n    \u30fb<strong>parameter_object<\/strong>\u30fb\u30fb\u30fb<strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\n  <\/div>\n<br \/>\n<div class=\"m30-l\">\n<p class=\"caution4\"><strong>Value \u30d7\u30ed\u30d1\u30c6\u30a3<\/strong><\/p>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><br \/>\n\t<em>parameter_object<\/em>.<strong>Value<\/strong>\n      <\/div>\n<\/p>\n<p>    <strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u5024\u306e\u53d6\u5f97\u304a\u3088\u3073\u8a2d\u5b9a\u3092\u3057\u307e\u3059\u3002<br \/>\n    \u30fb<strong>parameter_object<\/strong>\u30fb\u30fb\u30fb<strong>Parameter \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong>\n  <\/div>\n<\/div>\n<br \/><br \/>\n<h2>Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 \u305d\u306e\uff11<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"\u30d1\u30e9\u30e1\u30fc\u30bf\u30af\u30a8\u30ea\u3092\u5b9f\u884c\uff11\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_Command()\r\n    \r\n    '\u53c2\u7167\u8a2d\u5b9a:Microsoft ActiveX Data Objects 6.1 Library\r\n    \r\n    Dim cn As ADODB.Connection\r\n    Dim cmd As ADODB.Command\r\n    Dim rs As Object\r\n    Dim constr As String\r\n    Dim DBFile As String\r\n    Dim i As Long, j As Long\r\n    Dim strBack1, strBack2, strBack3, strBack4\r\n    \r\n    DBFile = ActiveWorkbook.Path & \"\\mydb1.accdb\"\r\n    constr = \"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" & DBFile\r\n    \r\n    Set cn = New ADODB.Connection\r\n    cn.ConnectionString = constr\r\n    cn.Open\r\n    \r\n    Set cmd = New ADODB.Command\r\n    cmd.ActiveConnection = cn\r\n    cmd.CommandText = \"[\u30c6\u30fc\u30d6\u30eb3 \u30af\u30a8\u30ea1]\"\r\n    \r\n    strBack1 = 1000\r\n    strBack2 = 2000\r\n    strBack3 = Trim(InputBox(\"\u5e74\u5ea6\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\uff08\u4f8b:2010\uff09\"))\r\n    strBack4 = Trim(InputBox(\"\u6708\u5ea6\u3092\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\uff08\u4f8b\uff1a3\uff09\"))\r\n    \r\n    Set rs = cmd.Execute(Parameters:=Array(strBack1, strBack2, strBack3, strBack4))\r\n    \r\n    With Worksheets(\"Sheet1\")\r\n        .Cells.Clear\r\n        rs.MoveFirst\r\n        i = 1\r\n        .Cells.Clear\r\n        Do Until rs.EOF\r\n            For j = 0 To rs.Fields.Count - 1\r\n                If i = 1 Then .Cells(i, j + 1) = rs(j).Name\r\n                .Cells(i + 1, j + 1) = rs(j).Value\r\n            Next j\r\n            rs.MoveNext\r\n            i = i + 1\r\n        Loop\r\n        .Columns(\"A:H\").AutoFit\r\n    End With\r\n    \r\n    rs.Close\r\n    Set rs = Nothing\r\n    Set cmd = Nothing\r\n    cn.Close\r\n    Set cn = Nothing\r\n    \r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>mydb1\u300c\u30c6\u30fc\u30d6\u30eb3 \u30af\u30a8\u30ea1\u300d\u306e\u5185\u5bb9<\/h3>\n<p>  <a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_01.jpg?ssl=1\" rel=\"lightbox[6148]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_01.jpg?resize=580%2C293&#038;ssl=1\" alt=\"mydb1\u300c\u30c6\u30fc\u30d6\u30eb3 \u30af\u30a8\u30ea1\u300d\u30c7\u30b6\u30a4\u30f3\u30d3\u30e5\u30fc\" width=\"580\" height=\"293\" class=\"alignnone size-large wp-image-6163\" srcset=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_01.jpg?resize=580%2C293&amp;ssl=1 580w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_01.jpg?resize=400%2C202&amp;ssl=1 400w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_01.jpg?resize=768%2C388&amp;ssl=1 768w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_01.jpg?w=1040&amp;ssl=1 1040w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p>  <a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_02.jpg?ssl=1\" rel=\"lightbox[6148]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_02.jpg?resize=415%2C143&#038;ssl=1\" alt=\"\uff08ADO\uff09Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u5b9f\u884c\u7d50\u679c\uff11\" width=\"415\" height=\"143\" class=\"alignnone size-full wp-image-6164\" srcset=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_02.jpg?w=415&amp;ssl=1 415w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_02.jpg?resize=400%2C138&amp;ssl=1 400w\" sizes=\"(max-width: 415px) 100vw, 415px\" data-recalc-dims=\"1\" \/><\/a><br \/>\n  <br \/>\n  <a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_03.jpg?ssl=1\" rel=\"lightbox[6148]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_03.jpg?resize=415%2C143&#038;ssl=1\" alt=\"\uff08ADO\uff09Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u5b9f\u884c\u7d50\u679c\uff12\" width=\"415\" height=\"143\" class=\"alignnone size-full wp-image-6165\" srcset=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_03.jpg?w=415&amp;ssl=1 415w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_03.jpg?resize=400%2C138&amp;ssl=1 400w\" sizes=\"(max-width: 415px) 100vw, 415px\" data-recalc-dims=\"1\" \/><\/a><br \/>\n  <br \/>\n  <a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_04.jpg?ssl=1\" rel=\"lightbox[6148]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_04.jpg?resize=580%2C204&#038;ssl=1\" alt=\"\uff08ADO\uff09Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u5b9f\u884c\u7d50\u679c\uff13\" width=\"580\" height=\"204\" class=\"alignnone size-large wp-image-6166\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_04.jpg?resize=580%2C204&amp;ssl=1 580w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_04.jpg?resize=400%2C141&amp;ssl=1 400w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_04.jpg?w=697&amp;ssl=1 697w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/>\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 \u305d\u306e\uff12<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"\u30d1\u30e9\u30e1\u30fc\u30bf\u30af\u30a8\u30ea\u3092\u5b9f\u884c\uff12\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_Command_CreateParameter()\r\n    \r\n    '\u53c2\u7167\u8a2d\u5b9a:Microsoft ActiveX Data Objects 6.1 Library\r\n    \r\n    Dim cn As ADODB.Connection\r\n    Dim cmd As ADODB.Command\r\n    Dim rs As ADODB.Recordset\r\n    Dim param As ADODB.Parameter\r\n    Dim constr As String\r\n    Dim DBFile As String\r\n    Dim i As Long\r\n    Dim j As Long\r\n    \r\n    DBFile = ActiveWorkbook.Path & \"\\mydb1.accdb\"\r\n    constr = \"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" & DBFile\r\n    \r\n    Set cn = New ADODB.Connection\r\n    cn.ConnectionString = constr\r\n    cn.Open\r\n    \r\n    Set cmd = New ADODB.Command\r\n    With cmd\r\n        .ActiveConnection = cn\r\n        .CommandType = adCmdText\r\n        .CommandText = \"select * from \u30c6\u30fc\u30d6\u30eb3 where \u4ed5\u5165\u5148C= ? and \u5e74\u5ea6= ? order by \u6708\u5ea6\"\r\n        .Prepared = True\r\n    End With\r\n    \r\n    Set param = New ADODB.Parameter\r\n    \r\n    Set param = cmd.CreateParameter(\"\u53d6\u5f15\u5148\", adInteger, adParamInput)\r\n    cmd.Parameters.Append param\r\n    cmd.Parameters(\"\u53d6\u5f15\u5148\").Value = Trim(InputBox(\"\u4ed5\u5165\u5148C\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\"))\r\n     \r\n    Set param = cmd.CreateParameter(\"\u5e74\u5ea6\", adInteger, adParamInput)\r\n    cmd.Parameters.Append param\r\n    cmd.Parameters(\"\u5e74\u5ea6\").Value = Trim(InputBox(\"\u5e74\u5ea6\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\"))\r\n    \r\n    Set rs = cmd.Execute\r\n    \r\n    With Worksheets(\"Sheet1\")\r\n        .Cells.Clear\r\n            rs.MoveFirst\r\n        i = 1\r\n        .Cells.Clear\r\n        Do Until rs.EOF\r\n            For j = 0 To rs.Fields.Count - 1\r\n                If i = 1 Then .Cells(i, j + 1) = rs(j).Name\r\n                .Cells(i + 1, j + 1) = rs(j).Value\r\n            Next j\r\n            rs.MoveNext\r\n            i = i + 1\r\n        Loop\r\n        .Columns(\"A:H\").AutoFit\r\n    End With\r\n    \r\n    Set cmd = Nothing\r\n    rs.Close\r\n    Set rs = Nothing\r\n    cn.Close\r\n    Set cn = Nothing\r\n    \r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_01.jpg?ssl=1\" rel=\"lightbox[6148]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_01.jpg?resize=415%2C143&#038;ssl=1\" alt=\"\uff08ADO\uff09Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u5b9f\u884c\u7d50\u679c\uff11\" width=\"415\" height=\"143\" class=\"alignnone size-full wp-image-6177\" srcset=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_01.jpg?w=415&amp;ssl=1 415w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_01.jpg?resize=400%2C138&amp;ssl=1 400w\" sizes=\"(max-width: 415px) 100vw, 415px\" data-recalc-dims=\"1\" \/><\/a><br \/>\n<br \/>\n<a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_02.jpg?ssl=1\" rel=\"lightbox[6148]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_02.jpg?resize=415%2C143&#038;ssl=1\" alt=\"\uff08ADO\uff09Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u5b9f\u884c\u7d50\u679c\uff12\" width=\"415\" height=\"143\" class=\"alignnone size-full wp-image-6178\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_02.jpg?w=415&amp;ssl=1 415w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_02.jpg?resize=400%2C138&amp;ssl=1 400w\" sizes=\"(max-width: 415px) 100vw, 415px\" data-recalc-dims=\"1\" \/><\/a><br \/>\n<br \/>\n<a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_03.jpg?ssl=1\" rel=\"lightbox[6148]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_03.jpg?resize=580%2C279&#038;ssl=1\" alt=\"\uff08ADO\uff09Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 \u5b9f\u884c\u7d50\u679c\uff13\" width=\"580\" height=\"279\" class=\"alignnone size-large wp-image-6179\" srcset=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_03.jpg?resize=580%2C279&amp;ssl=1 580w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_03.jpg?resize=400%2C193&amp;ssl=1 400w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand2_03.jpg?w=696&amp;ssl=1 696w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>\u30af\u30a8\u30ea\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3057\u3066\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\u624b\u9806 Command \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":6168,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[948],"tags":[953,990,950,989,991,721,968,996,998,997,951,814,955,949,835],"jetpack_featured_media_url":"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2017\/08\/adocommand_05.jpg?fit=427%2C194&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1Ba","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6148"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=6148"}],"version-history":[{"count":35,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6148\/revisions"}],"predecessor-version":[{"id":6483,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/6148\/revisions\/6483"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/6168"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=6148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=6148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=6148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}