{"id":4475,"date":"2014-05-29T11:35:23","date_gmt":"2014-05-29T02:35:23","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=4475"},"modified":"2014-05-29T11:35:23","modified_gmt":"2014-05-29T02:35:23","slug":"%e7%a9%ba%e7%99%bd%e6%96%87%e5%ad%97%e3%82%92%e4%b8%80%e6%8b%ac%e7%bd%ae%e6%8f%9b%e3%81%99%e3%82%8bword%e3%83%9e%e3%82%af%e3%83%ad","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=4475","title":{"rendered":"\u7a7a\u767d\u6587\u5b57\u3092\u4e00\u62ec\u7f6e\u63db\u3059\u308bWord\u30de\u30af\u30ed"},"content":{"rendered":"<p>\u69d8\u3005\u306aWord\u6587\u66f8\u3092\u6271\u3063\u3066\u3044\u308b\u3068\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306b<span style=\"color: #ff0000; font-weight: bold;\">\u201c\u540c\u3058\u7a7a\u767d\u306e\u3088\u3046\u306b\u898b\u3048\u3066\u3082\u5b9f\u306f\u9055\u3046\u6587\u5b57\u201d<\/span>\u306b\u906d\u9047\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_01.jpg\" alt=\"WordSpace_01_01\" width=\"1172\" height=\"606\" class=\"alignnone size-full wp-image-4476\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_01.jpg 1172w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_01-300x155.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_01-1024x529.jpg 1024w\" sizes=\"auto, (max-width: 1172px) 100vw, 1172px\" \/><\/a><\/p>\n<p>\u4eca\u56de\u306f\u305d\u3093\u306a<span style=\"color: #ff0000; font-weight: bold;\">\u7a7a\u767d\u6587\u5b57<\/span>\u3092\u540c\u3058\u6587\u5b57\u306b\u7d71\u4e00(\u3082\u3057\u304f\u306f\u524a\u9664)\u3059\u308bWord\u30de\u30af\u30ed\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  ReplaceSpace 2 '\u7a7a\u767d\u6587\u5b57\u3092\u5168\u89d2\u30b9\u30da\u30fc\u30b9\u306b\u7f6e\u63db\r\n  MsgBox &quot;\u51e6\u7406\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002&quot;, vbInformation + vbSystemModal\r\nEnd Sub\r\n\r\nPublic Sub ReplaceSpace(Optional ByVal Opt As Long = 0)\r\n'\u7a7a\u767d\u6587\u5b57\u7f6e\u63db\r\n'Opt 0:\u524a\u9664 , 1:\u534a\u89d2\u30b9\u30da\u30fc\u30b9(U+0020)\u306b\u7f6e\u63db , 2:\u5168\u89d2\u30b9\u30da\u30fc\u30b9(U+3000)\u306b\u7f6e\u63db\r\n  Dim spaces As Variant\r\n  Dim src As String, tgt As String\r\n  Dim i As Long\r\n  \r\n  Select Case Opt\r\n    Case 0: tgt = &quot;&quot;\r\n    Case 1: tgt = ChrW(&amp;H20)\r\n    Case 2: tgt = ChrW(&amp;H3000)\r\n    Case Else\r\n      MsgBox &quot;\u5f15\u6570Opt\u306b\u306f 0 - 2 \u306e\u5024\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;, vbExclamation + vbSystemModal\r\n      Exit Sub\r\n  End Select\r\n  \r\n  '\u7a7a\u767d\u6587\u5b57\u306e\u5b9a\u7fa9\r\n  'http:\/\/en.wikipedia.org\/wiki\/Space_%28punctuation%29 \u53c2\u7167\r\n  spaces = Array(&amp;H20, _\r\n                 &amp;HA0, _\r\n                 &amp;H1680, _\r\n                 &amp;H180E, _\r\n                 &amp;H2000, _\r\n                 &amp;H2001, _\r\n                 &amp;H2002, _\r\n                 &amp;H2003, _\r\n                 &amp;H2004, _\r\n                 &amp;H2005, _\r\n                 &amp;H2006, _\r\n                 &amp;H2007, _\r\n                 &amp;H2008, _\r\n                 &amp;H2009, _\r\n                 &amp;H200A, _\r\n                 &amp;H200B, _\r\n                 &amp;H200C, _\r\n                 &amp;H200D, _\r\n                 &amp;H202F, _\r\n                 &amp;H205F, _\r\n                 &amp;H2060, _\r\n                 &amp;H3000, _\r\n                 &amp;HFEFF)\r\n  \r\n  src = &quot;&#x5B;&quot;\r\n  For i = LBound(spaces) To UBound(spaces)\r\n    src = src &amp; ChrW(spaces(i))\r\n  Next\r\n  src = src &amp; &quot;]&quot;\r\n  ReplaceStr src, tgt\r\nEnd Sub\r\n\r\nPrivate Sub ReplaceStr(ByVal SourceString As String, ByVal TargetString As String)\r\n'\u6587\u5b57\u7f6e\u63db\r\n  With ActiveDocument.Content.Find\r\n    .ClearFormatting\r\n    .Text = SourceString\r\n    With .Replacement\r\n      .ClearFormatting\r\n      .Text = TargetString\r\n    End With\r\n    .Forward = True\r\n    .Wrap = wdFindStop\r\n    .Format = False\r\n    .MatchCase = False\r\n    .MatchWholeWord = False\r\n    .MatchByte = False\r\n    .MatchAllWordForms = False\r\n    .MatchSoundsLike = False\r\n    .MatchWildcards = True\r\n    .MatchFuzzy = False\r\n    .Execute Replace:=wdReplaceAll\r\n  End With\r\nEnd Sub<\/pre>\n<p>\u4e0a\u8a18\u30de\u30af\u30ed\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u6587\u66f8\u306e\u4e2d\u306b\u3042\u308b\u7a7a\u767d\u6587\u5b57\u3092\u3059\u3079\u3066\u5168\u89d2\u30b9\u30da\u30fc\u30b9(U+3000)\u306b\u7f6e\u304d\u63db\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_02.jpg\" alt=\"WordSpace_01_02\" width=\"825\" height=\"330\" class=\"alignnone size-full wp-image-4477\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_02.jpg 825w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/WordSpace_01_02-300x120.jpg 300w\" sizes=\"auto, (max-width: 825px) 100vw, 825px\" \/><\/a><\/p>\n<p>\u7a7a\u767d\u6587\u5b57\u306e\u51e6\u7406\u306b\u304a\u56f0\u308a\u306e\u65b9\u306f\u662f\u975e\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u69d8\u3005\u306aWord\u6587\u66f8\u3092\u6271\u3063\u3066\u3044\u308b\u3068\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306b\u201c\u540c\u3058\u7a7a\u767d\u306e\u3088\u3046\u306b\u898b\u3048\u3066\u3082\u5b9f\u306f\u9055\u3046\u6587\u5b57\u201d\u306b\u906d\u9047\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002 \u4eca\u56de\u306f\u305d\u3093\u306a\u7a7a\u767d\u6587\u5b57\u3092\u540c\u3058\u6587\u5b57\u306b\u7d71\u4e00(\u3082\u3057\u304f\u306f\u524a\u9664)\u3059\u308bWord\u30de\u30af\u30ed\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 Option Exp [&hellip;]","protected":false},"author":1,"featured_media":7134,"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,49],"tags":[],"class_list":["post-4475","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-word-office"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Word.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1ab","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4475","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=4475"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4475\/revisions"}],"predecessor-version":[{"id":4478,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4475\/revisions\/4478"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7134"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}