{"id":4409,"date":"2021-03-27T21:52:27","date_gmt":"2021-03-27T12:52:27","guid":{"rendered":"https:\/\/draft.ecophysical.com\/?p=4409"},"modified":"2021-03-27T21:55:38","modified_gmt":"2021-03-27T12:55:38","slug":"%e3%80%90%e5%88%9d%e5%bf%83%e8%80%85%e3%81%a7%e3%82%82%e3%81%a7%e3%81%8d%e3%82%8b%e3%80%91word-vba%e3%81%a7%e5%8a%b9%e7%8e%87%e7%9a%84%e3%81%ab%e7%9b%ae%e6%ac%a1%e4%bd%9c%e6%88%90%e3%82%b5%e3%83%96","status":"publish","type":"post","link":"https:\/\/draft.ecophysical.com\/?p=4409","title":{"rendered":"\u3010\u521d\u5fc3\u8005\u3067\u3082\u3067\u304d\u308b\u3011Word VBA\u3067\u52b9\u7387\u7684\u306b\u76ee\u6b21\u4f5c\u6210(\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u5185\u30d5\u30a1\u30a4\u30eb\u306e\u76ee\u6b21\u4f5c\u6210)"},"content":{"rendered":"<p><span class=\"kmain\">Word\u3067\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u3063\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u76ee\u6b21\u3092\u4f5c\u6210\u3057\u305f\u3044\uff01\uff01<\/span><\/p>\n<p>\u3057\u304b\u3082<span class=\"kmain\">\u30cf\u30a4\u30d1\u30fc\u30ea\u30f3\u30af\u3067\u30ea\u30f3\u30af\u3092\u633f\u5165\u3057\u3001\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u5bfe\u8c61\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u958b\u304f\u3088\u3046\u306b\u3057\u305f\u3044\uff01\uff01<\/span><\/p>\n<p>\u3068\u601d\u3063\u305f\u4e8b\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f\uff1f<\/p>\n<p>\u3064\u307e\u308a\u3001\u3053\u3046\u3044\u3046\u4e8b\u3067\u3059\u306d\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/draft.ecophysical.com\/wp-content\/uploads\/2021\/03\/filehierarchy.jpg\" alt=\"\" width=\"550\" border=\"0\"><\/p>\n<p>\u3053\u3053\u3067\u306f\u3001<span class=\"kmain\">\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u3057\u305f\u4e8b\u304c\u7121\u304f\u3066\u3082\u3001Word VBA\u3092\u4f7f\u3063\u3066\u76ee\u6b21\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5<\/span>\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2>\u3010\u52d5\u753b\u3067\u78ba\u8a8d\u3011\u5b9f\u884c\u3059\u308b\u3068\u3069\u3046\u306a\u308b\u304b\uff1f<\/h2>\n<p>\u307e\u305a\u521d\u3081\u306b<span class=\"sub\">\u3069\u306e\u3088\u3046\u306b\u76ee\u6b21\u304c\u4f5c\u6210\u3055\u308c\u308b\u304b<\/span>\u3092\u8aac\u660e\u3057\u307e\u3059\u3002\u624b\u9806\u306f\u3053\u3061\u3089<\/p>\n<p>\u2460Word\u6587\u66f8\u306b\u5165\u529b\u3055\u308c\u3066\u3044\u308b\u6587\u7ae0\u3092<span class=\"kmain\">\u3059\u3079\u3066\u524a\u9664<\/span>\u3059\u308b\u3002<br \/>\n\u2461<span class=\"sub\">\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u540d<\/span>\u3068<span class=\"sub\">\u30cf\u30a4\u30d1\u30fc\u30ea\u30f3\u30af\u304c\u633f\u5165\u3055\u308c\u305f\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u540d<\/span>\u304c\u5165\u529b\u3055\u308c\u308b\u3002<\/p>\n<p><span class=\"kmain\">\u308f\u304b\u308a\u306b\u304f\u3044\u306e\u3067\u3001\u52d5\u753b\u306b\u3057\u3066\u3044\u307e\u3059\u2193<\/span><br \/>\n<iframe src=\"https:\/\/www.youtube.com\/embed\/niv8S2yORG0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" width=\"560\" height=\"315\" frameborder=\"0\"><\/iframe><\/p>\n<h2>\u76ee\u6b21\u4f5c\u6210\u306eWord VBA\u306e\u30b3\u30fc\u30c9\u3010Word VBA\u306e\u7d4c\u9a13\u8005\u7528\u3011<\/h2>\n<p><span class=\"sub\">Word VBA\u3092\u4f7f\u3063\u305f\u4e8b\u306e\u3042\u308b\u65b9<\/span>\u306f\u3001<span class=\"sub\">\u30b3\u30fc\u30c9\u3060\u3051\u3067\u5341\u5206<\/span>\u3060\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002<br \/>\n\uff0aWord VBA\u3092\u4f7f\u3063\u305f\u3053\u3068\u306e\u306a\u3044\u65b9\u306f\u3001\u4ee5\u4e0b\u3067\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u95b2\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u30b3\u30fc\u30c9<\/h3>\n<p><span class=\"kmain\">\u76ee\u6b21\u4f5c\u6210\u306eWord VBA\u306e\u30b3\u30fc\u30c9<\/span><\/p>\n<pre><code>\nOption Explicit  \n    Dim lngParaCnt As Long '\u6bb5\u843d\u756a\u53f7\u3092\u6570\u3048\u308b\u5909\u6570\n    \n'\u76ee\u6b21\u751f\u6210\u3092\u4f5c\u6210\u3059\u308b\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\nPrivate Sub Mokuji()\n    Dim FSO As Object\n    Dim fsoFolderElement As Object\n    Dim fsoFileElement As Object\n    Dim rng As Range\n    ThisDocument.StoryRanges(wdMainTextStory).Delete '\u672c\u6587\u3092\u5168\u3066\u524a\u9664\u3059\u308b\n    Set FSO = CreateObject(\"Scripting.FileSystemObject\")    \n    lngParaCnt = 1 '\u6bb5\u843d\u756a\u53f71\u3092\u4ee3\u5165  \n\n'\u76ee\u6b21\u30da\u30fc\u30b8\u306e\u3042\u308b\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u540d\u3092\u53d6\u5f97\u3059\u308b\n    For Each fsoFolderElement In FSO.GetFolder(ThisDocument.Path).subfolders\n        If fsoFolderElement.Attributes = 16 Then '\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u304c\u30d5\u30a9\u30eb\u30c0\u304b\u3069\u3046\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b\n            Selection.TypeText \"\u3010\" &amp; fsoFolderElement.Name &amp; \"\u3011\" '\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u540d\u3092\u672c\u6587\u306b\u66f8\u304d\u8fbc\u3080\n            Selection.TypeParagraph '\u6539\u884c\u3059\u308b\n            lngParaCnt = lngParaCnt + 1 '\u6bb5\u843d\u756a\u53f7\u306b1\u3092\u8ffd\u52a0\u3059\u308b\n            Call MidashiSearch(fsoFolderElement.Path)\n        End If\n    Next fsoFolderElement\n    Set FSO = Nothing\nEnd Sub\n\n'\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3068\u30d5\u30a9\u30eb\u30c0\u3092\u8abf\u3079\u308b\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3  \nSub MidashiSearch(strFilePath As String)\n    Dim strFileName As String\n    Dim rng As Range\n    strFileName = Dir(strFilePath &amp; \"\\*.*\")\n    Do While strFileName &lt;&gt; \"\"\n        Set rng = ThisDocument.Paragraphs(lngParaCnt).Range '\u73fe\u5728\u306e\u30ab\u30fc\u30bd\u30eb\u306e\u6bb5\u843d\u3092\u53d6\u5f97\u3059\u308b\n        ThisDocument.Hyperlinks.Add Anchor:=rng, Address:=strFilePath &amp; \"\\\" &amp; strFileName, TextToDisplay:=strFileName '\u73fe\u5728\u306e\u6bb5\u843d\u306b\u30cf\u30a4\u30d1\u30fc\u30ea\u30f3\u30af\u3092\u8a2d\u5b9a\n        Selection.Move wdSentence, 1 '\u30ab\u30fc\u30bd\u30eb\u3092\u6587\u306e\u672b\u5c3e\u3078\u79fb\u52d5\u3059\u308b\n        Selection.TypeParagraph '\u6539\u884c\u3059\u308b\n        lngParaCnt = lngParaCnt + 1\n        strFileName = Dir() '\u6b21\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092strFileName\u306b\u4ee3\u5165\u3059\u308b\n    Loop\n    Selection.TypeParagraph '\u6539\u884c\u3059\u308b\n    lngParaCnt = lngParaCnt + 1\nEnd Sub\n<\/code><\/pre>\n<h3>\u30b3\u30fc\u30c9\u306e\u8cbc\u308a\u4ed8\u3051\u5834\u6240<\/h3>\n<p>\u30b3\u30fc\u30c9\u306e\u8cbc\u308a\u4ed8\u3051\u5834\u6240\u306f\u3053\u3061\u3089\u3067\u3059(<span class=\"kmain\">ThisDocument\u306e\u3068\u3053\u308d<\/span>)\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/draft.ecophysical.com\/wp-content\/uploads\/2021\/03\/codeharituke.jpg\" alt=\"\" width=\"505\" border=\"0\"><\/p>\n<h2>\u3010Word VBA\u3092\u4f7f\u3063\u305f\u4e8b\u304c\u7121\u3044\u65b9\u3078\u3011\u30b3\u30fc\u30c9\u306e\u4f7f\u3044\u65b9<\/h2>\n<p><span class=\"kmain\">Word VBA\u3092\u4f7f\u7528\u3057\u305f\u4e8b\u304c\u306a\u304f\u3001\u3010\u4f7f\u7528\u3060\u3051\u3057\u305f\u3044\u65b9\u3011<\/span>\u306b\u5411\u3051\u3066\u3001<span class=\"kmain\">\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308b\u307e\u3067\u306e\u624b\u9806<\/span>\u3092\u89e3\u8aac\u3057\u307e\u3059(<span class=\"sub\">5\u5206\u304f\u3089\u3044<\/span>\u3067\u3067\u304d\u307e\u3059)\u3002\u4ee5\u4e0b\u306e\u624b\u9806\u306b\u6cbf\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>Word\u306b\u300c\u958b\u767a\u300d\u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p>Word\u3067VBA\u3092\u4f7f\u7528\u3059\u308b\u70ba\u306b\u306f\u3001<span class=\"sub\">\u30ea\u30dc\u30f3\u306b\u300c\u958b\u767a\u300d\u30bf\u30d6\u3092\u8ffd\u52a0\u3059\u308b<\/span>\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u8ffd\u52a0\u65b9\u6cd5\u306e\u52d5\u753b\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<br \/>\n<iframe src=\"https:\/\/www.youtube.com\/embed\/l70-j1LbORI?start=14\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" width=\"560\" height=\"315\" frameborder=\"0\"><\/iframe><\/p>\n<h3>\u300cWord\u30de\u30af\u30ed\u6709\u52b9\u6587\u66f8\u300d\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>\u6b21\u306b<span class=\"sub\">Word\u30de\u30af\u30ed\u6709\u52b9\u6587\u66f8\u3092\u4f5c\u6210\u3059\u308b<\/span>\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u3061\u3089\u3082\u52d5\u753b\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n<iframe src=\"https:\/\/www.youtube.com\/embed\/EoEYJtpeItA\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" width=\"560\" height=\"315\" frameborder=\"0\"><\/iframe><\/p>\n<h3>Word\u30de\u30af\u30ed\u6709\u52b9\u6587\u66f8\u306b\u300cWord VBA\u306e\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u308b\u300d<\/h3>\n<p>Word\u30de\u30af\u30ed\u6709\u52b9\u6587\u66f8\u306b\u3001<span class=\"sub\">Word VBA\u306e\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u308b<\/span>\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u624b\u9806\u306b\u3064\u3044\u3066\u306f\u4e0b\u306e\u52d5\u753b\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\uff0aWord VBA\u306e\u30b3\u30fc\u30c9\u306f\u4e0a\u8ff0\u306e\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n<iframe src=\"https:\/\/www.youtube.com\/embed\/6gCjcXdLquM\" title=\"YouTube video player\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" width=\"560\" height=\"315\" frameborder=\"0\"><\/iframe><\/p>\n<h3>\u76ee\u6b21\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>\u3067\u306f\u3001\u3055\u3063\u305d\u304f<span class=\"sub\">\u76ee\u6b21\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01\uff01<\/span><\/p>\n<p><span class=\"sub\">\u52d5\u753b\u3067\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u2193<\/span><br \/>\n<iframe src=\"https:\/\/www.youtube.com\/embed\/SyLqO768oEI\" title=\"YouTube video player\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" width=\"560\" height=\"315\" frameborder=\"0\"><\/iframe><\/p>\n<p><span class=\"kmain\">\u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u3001\u5b9f\u884c\u3055\u308c\u308b\u3068\u307e\u305a\u5165\u529b\u3055\u308c\u3066\u3044\u308b\u6587\u7ae0\u3092\u5168\u3066\u524a\u9664\u3057\u3066\u304b\u3089\u3001\u76ee\u6b21\u3092\u4f5c\u6210\u3057\u307e\u3059\u306e\u3067\u3001\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<\/span><\/p>\n<p>\uff0a\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3093\u3067\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3063\u3066\u4fbf\u5229\u3060\u306a\u3068\u601d\u3063\u305f\u65b9\u306b\u304a\u52e7\u3081\u3057\u305f\u3044\u306e\u306f\u3001\u3053\u306e\u7d75\u672c\u30b7\u30ea\u30fc\u30ba\u3067\u3059\u3002\u521d\u3081\u3066\u306e\u4eba\u3067\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u3001\u79c1\u306f\u3053\u3053\u304b\u3089\u52c9\u5f37\u3092\u59cb\u3081\u307e\u3057\u305f\u3002<br \/>\n[amazon asin=&#8221;4798146749&#8243; price=1 kw=&#8221;\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u7d75\u672c&#8221; size=&#8221;m&#8221;]<\/p>\n<h2>\u6ce8\u610f\u70b9<\/h2>\n<p>\u30fb\u3042\u304f\u307e\u3067\u81ea\u5206\u7528\u3068\u3057\u3066\u4f5c\u6210\u3057\u307e\u3057\u305f\u306e\u3067\u3001\u601d\u308f\u306c\u6319\u52d5\u3092\u3059\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u306e\u3067\u3001\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044(\u304a\u305d\u3089\u304f\u5927\u4e08\u592b\u3060\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u30fb\u30fb\u30fb\u5ff5\u306e\u305f\u3081\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u3068\u3063\u3066\u9802\u3051\u305f\u3089\u5b89\u5fc3\u3060\u3068\u601d\u3044\u307e\u3059)\u3002\u4f7f\u7528\u3059\u308b\u969b\u306b\u306f\u81ea\u5df1\u8cac\u4efb\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Word\u3067\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u306b\u5165\u3063\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u76ee\u6b21\u3092\u4f5c\u6210\u3057\u305f\u3044\uff01\uff01 \u3057\u304b\u3082\u30cf\u30a4\u30d1\u30fc\u30ea\u30f3\u30af\u3067\u30ea\u30f3\u30af\u3092\u633f\u5165\u3057\u3001\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u5bfe\u8c61\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u958b\u304f\u3088\u3046\u306b\u3057\u305f\u3044\uff01\uff01 \u3068\u601d\u3063\u305f\u4e8b\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f\uff1f \u3064\u307e\u308a\u3001\u3053\u3046 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":4411,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","columnck":"","stmeta_robots":"","st_titlewords":"","st_title_extra":"","st_keywords":"","st_description":"","st_display_ad_mark":"","st_display_ad_mark_hide":"","textcopyck":"","st_copyright":"","st_copyurl":"","eyecatch_set":"","st_youtube_url":"","st_youtube_eyecatch":"","headerwidget_set":"","updatewidget_set":"","kanrenwidget_set":"","ikkatuwidget_set":"","koukoku_set":"","auto_adsense_koukoku_set":"","st_redirect":"","st_redirect_url_as_canonical":"","st_redirect_pvm_do_not_track":"","post_data_updatewidget_set":"","st_post_header_under_bg":"","st_twitter_tag":"","affinger_note":"","rankdisplayck":"","st_head_code":"","st_footer_code":"","st_post_header_under_code":"","_st_toc_override":false,"_st_toc_settings":[]},"categories":[8],"tags":[],"class_list":["post-4409","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-personalcomputer"],"_links":{"self":[{"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=\/wp\/v2\/posts\/4409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4409"}],"version-history":[{"count":26,"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=\/wp\/v2\/posts\/4409\/revisions"}],"predecessor-version":[{"id":4583,"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=\/wp\/v2\/posts\/4409\/revisions\/4583"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=\/wp\/v2\/media\/4411"}],"wp:attachment":[{"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/draft.ecophysical.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}