{"id":1294,"date":"2012-02-22T14:40:36","date_gmt":"2012-02-22T05:40:36","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=1294"},"modified":"2012-02-22T16:18:34","modified_gmt":"2012-02-22T07:18:34","slug":"mdbaccess%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99%e3%83%bc%e3%82%b9%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e4%bd%9c%e6%88%90%e3%81%97%e3%81%a6%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e6%a0%bc%e7%b4%8d","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=1294","title":{"rendered":"MDB(Access\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9)\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308bExcel\u30de\u30af\u30ed"},"content":{"rendered":"<p><span style=\"color: #ff0000; font-weight: bold;\">2012\/2\/22\u8ffd\u8a18\uff1a<\/span><br \/>\n\u4e0b\u8a18\u3067\u4f5c\u6210\u3057\u305fMDB\u30d5\u30a1\u30a4\u30eb\u3092\u5229\u7528\u3057\u305f<a href=\"\/\/www.ka-net.org\/blog\/?p=1303\" title=\"MDB\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u8aad\u307f\u8fbc\u3093\u3060\u5358\u8a9e\u3092\u691c\u7d22\u3057\u3001\u30d2\u30c3\u30c8\u3057\u305f\u3089\u5358\u8a9e\u306e\u610f\u5473\u3092\u30b3\u30e1\u30f3\u30c8\u306b\u3059\u308bWord\u30de\u30af\u30ed\" target=\"_blank\">Word\u30de\u30af\u30ed<\/a>\u3092\u8003\u3048\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u306e\u683c\u7d0d\u5148\u3068\u3057\u3066CSV\u30d5\u30a1\u30a4\u30eb\u304c\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u304c\u3001\u6570\u4e07\u4ef6\u5358\u4f4d\u306e\u30c7\u30fc\u30bf\u306b\u306a\u308b\u3068CSV\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u5c11\u3005\u6271\u3044\u3065\u3089\u304f\u306a\u3063\u3066\u304d\u307e\u3059\u3002<br \/>\n\u305d\u3053\u3067\u4eca\u56de\u306fMDB\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u30de\u30af\u30ed\u3092\u8003\u3048\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30c6\u30b9\u30c8\u306b\u306f\u300c<a href=\"http:\/\/kujirahand.com\/web-tools\/EJDictFreeDL.php\" title=\"WEB\u4fbf\u5229\u30c4\u30fc\u30eb\" target=\"_blank\">WEB\u4fbf\u5229\u30c4\u30fc\u30eb<\/a>\u300d\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u8f9e\u66f8\u30c7\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u307e\u3057\u305f(A\u3001B\u5217\u3068\u3082\u306b\u6587\u5b57\u5217\u3068\u3057\u3066\u8aad\u307f\u8fbc\u307f)\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_01-150x150.jpg\" alt=\"\" title=\"CreateMDB_01\" width=\"150\" height=\"150\" class=\"alignnone size-thumbnail wp-image-1295\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_01-150x150.jpg 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_01-75x75.jpg 75w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_02-150x150.jpg\" alt=\"\" title=\"CreateMDB_02\" width=\"150\" height=\"150\" class=\"alignnone size-thumbnail wp-image-1296\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_02-150x150.jpg 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_02-75x75.jpg 75w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><br \/>\n<!--more--><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub CreateMDB()\r\n'MDB\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\r\n  Dim DBFilePath As String\r\n  Dim con As String\r\n  Dim tbl As Object\r\n  Dim cn As Object\r\n  Dim i As Long\r\n  \r\n  Const TableName As String = &quot;tblDic&quot; '\u30c6\u30fc\u30d6\u30eb\u540d\r\n  Const FieldName1 As String = &quot;word&quot; '\u30d5\u30a3\u30fc\u30eb\u30c9\u540d1\r\n  Const FieldName2 As String = &quot;meaning&quot; '\u30d5\u30a3\u30fc\u30eb\u30c9\u540d2\r\n  \r\n  DBFilePath = ThisWorkbook.Path &amp; Application.PathSeparator &amp; &quot;MyDB.mdb&quot;\r\n  If Len(Dir(DBFilePath)) &gt; 0 Then Kill DBFilePath '\u4e8b\u524d\u306b\u524a\u9664\r\n  con = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; &amp; DBFilePath\r\n  \r\n  'MDB\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\r\n  With CreateObject(&quot;ADOX.Catalog&quot;)\r\n    .Create con\r\n    Set cn = .ActiveConnection\r\n    '\u30c6\u30fc\u30d6\u30eb\u8ffd\u52a0\r\n    Set tbl = CreateObject(&quot;ADOX.Table&quot;)\r\n    tbl.Name = TableName\r\n    tbl.Columns.Append FieldName1, &amp;HCA '\u30c6\u30ad\u30b9\u30c8\u578b\r\n    tbl.Columns.Append FieldName2, &amp;HCB '\u30e1\u30e2\u578b\r\n    .Tables.Append tbl\r\n    Set tbl = Nothing\r\n  End With\r\n  \r\n  '\u30ec\u30b3\u30fc\u30c9\u8ffd\u52a0\r\n  With CreateObject(&quot;ADODB.Recordset&quot;)\r\n    .Open TableName, cn, 1, 3\r\n    For i = 1 To ActiveSheet.Range(&quot;A1&quot;).End(xlDown).Row\r\n      Application.StatusBar = &quot;\u51e6\u7406\u4e2d:&quot; &amp; i &amp; &quot; \/ &quot; &amp; ActiveSheet.Range(&quot;A1&quot;).End(xlDown).Row '\u30b9\u30c6\u30fc\u30bf\u30b9\u30d0\u30fc\u306b\u72b6\u6cc1\u8868\u793a\r\n      .AddNew\r\n      .Fields(FieldName1).Value = ActiveSheet.Cells(i, 1).Value\r\n      .Fields(FieldName2).Value = ActiveSheet.Cells(i, 2).Value\r\n      .Update\r\n      DoEvents\r\n    Next\r\n    .Close\r\n  End With\r\n  cn.Close\r\n  Set cn = Nothing\r\n  \r\n  MsgBox &quot;\u51e6\u7406\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002&quot;, vbInformation + vbSystemModal\r\n  Application.StatusBar = False\r\nEnd Sub<\/pre>\n<p>\u51e6\u7406\u7d42\u4e86\u5f8c\u3001\u4f5c\u6210\u3055\u308c\u305fMDB\u30d5\u30a1\u30a4\u30eb\u3092Access\u3067\u958b\u3044\u3066\u307f\u308b\u3068\u3001\u7121\u4e8b\u306b\u30c7\u30fc\u30bf\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_03.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_03-150x150.jpg\" alt=\"\" title=\"CreateMDB_03\" width=\"150\" height=\"150\" class=\"alignnone size-thumbnail wp-image-1297\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_03-150x150.jpg 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_03-75x75.jpg 75w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_04.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_04-150x150.jpg\" alt=\"\" title=\"CreateMDB_04\" width=\"150\" height=\"150\" class=\"alignnone size-thumbnail wp-image-1298\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_04-150x150.jpg 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CreateMDB_04-75x75.jpg 75w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<p>\u3069\u3046\u3084\u3089\u4e0a\u624b\u304f\u51e6\u7406\u3067\u304d\u305f\u3088\u3046\u3067\u3059\u3002<br \/>\n(ADO\u3084ADOX\u306f\u4e45\u3057\u304f\u6271\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u8272\u3005\u3068\u601d\u3044\u51fa\u3057\u306a\u304c\u3089\u306e\u4f5c\u696d\u3067\u3057\u305f\u2026(^^; )<\/p>\n","protected":false},"excerpt":{"rendered":"2012\/2\/22\u8ffd\u8a18\uff1a \u4e0b\u8a18\u3067\u4f5c\u6210\u3057\u305fMDB\u30d5\u30a1\u30a4\u30eb\u3092\u5229\u7528\u3057\u305fWord\u30de\u30af\u30ed\u3092\u8003\u3048\u3066\u307f\u307e\u3057\u305f\u3002 \u30c7\u30fc\u30bf\u306e\u683c\u7d0d\u5148\u3068\u3057\u3066CSV\u30d5\u30a1\u30a4\u30eb\u304c\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u304c\u3001\u6570\u4e07\u4ef6\u5358\u4f4d\u306e\u30c7\u30fc\u30bf\u306b\u306a\u308b\u3068CSV\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u5c11\u3005\u6271\u3044\u3065\u3089\u304f\u306a\u3063\u3066\u304d\u307e [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,48],"tags":[11,35,46],"class_list":["post-1294","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","tag-office-2","tag-35","tag-excel"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-kS","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1294"}],"version-history":[{"count":5,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1294\/revisions"}],"predecessor-version":[{"id":1309,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1294\/revisions\/1309"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7111"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}