{"id":859,"date":"2011-11-04T13:50:03","date_gmt":"2011-11-04T04:50:03","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=859"},"modified":"2012-09-05T16:51:01","modified_gmt":"2012-09-05T07:51:01","slug":"%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%9c%e3%83%83%e3%82%af%e3%82%b9%e7%ad%89shape%e3%82%aa%e3%83%96%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%81%ae%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%81%ae","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=859","title":{"rendered":"\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u7b49Shape\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30c6\u30ad\u30b9\u30c8\u306e\u307f\u3092\u7f6e\u63db\u3059\u308bWord\u30de\u30af\u30ed"},"content":{"rendered":"<p>Word MVP\u306e\u65b0\u7530\u3055\u3093\u306e\u30d6\u30ed\u30b0\u3067\u6c17\u306b\u306a\u308b\u8a18\u4e8b\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>&#8220;<a href=\"http:\/\/ameblo.jp\/gidgeerock\/entry-11068165869.html\" title=\"\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u5185\u306e\u6587\u5b57\u3092\u7f6e\u63db\u3059\u308b\u30de\u30af\u30ed\" target=\"_blank\">\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u5185\u306e\u6587\u5b57\u3092\u7f6e\u63db\u3059\u308b\u30de\u30af\u30ed<\/a>&#8221;<\/p>\n<p>\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u7b49Shape\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30c6\u30ad\u30b9\u30c8\u306e\u307f\u3092\u7f6e\u63db\u3059\u308bWord\u30de\u30af\u30ed\u3067\u3059\u3002<br \/>\n\u3053\u308c\u307e\u3067\u672c\u6587\u306e\u307f\u3001\u3082\u3057\u304f\u306f\u30aa\u30fc\u30c8\u30b7\u30a7\u30a4\u30d7\u3092\u542b\u3081\u305f\u6587\u66f8\u5168\u4f53\u306e\u6587\u5b57\u5217\u7f6e\u63db\u3068\u3044\u3046\u306e\u306f\u884c\u3063\u305f\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001<span style=\"color: #ff0000; font-weight: bold;\">Shape\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f\u3092\u5bfe\u8c61\u3068\u3057\u305f\u6587\u5b57\u5217\u7f6e\u63db<\/span>\u306f\u884c\u3063\u305f\u3053\u3068\u304c\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u79c1\u306e\u65b9\u3067\u3082\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<!--more--><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  Dim Shp As Shape\r\n  Dim GrpShp As Shape\r\n  Dim CvsShp As Shape\r\n  Dim CvsGrpShp As Shape\r\n  \r\n  Const SrcText As String = &quot;\u3042\u3044\u3046\u3048\u304a&quot; '\u691c\u7d22\u3059\u308b\u6587\u5b57\u5217\r\n  Const DestText As String = &quot;\u304b\u304d\u304f\u3051\u3053&quot; '\u7f6e\u63db\u5f8c\u306e\u6587\u5b57\u5217\r\n  \r\n  For Each Shp In ActiveDocument.Shapes\r\n    If Shp.Type = msoCanvas Then\r\n    '\u63cf\u753b\u30ad\u30e3\u30f3\u30d0\u30b9\u306e\u5834\u5408\u306e\u51e6\u7406\r\n      For Each CvsShp In Shp.CanvasItems\r\n        If CvsShp.Type = msoGroup Then\r\n          For Each CvsGrpShp In CvsShp.GroupItems\r\n            ReplaceShapeText CvsGrpShp, SrcText, DestText\r\n          Next\r\n        Else\r\n          ReplaceShapeText CvsShp, SrcText, DestText\r\n        End If\r\n      Next\r\n    ElseIf Shp.Type = msoGroup Then\r\n    '\u30b0\u30eb\u30fc\u30d7\u5316\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306e\u51e6\u7406\r\n      For Each GrpShp In Shp.GroupItems\r\n        ReplaceShapeText GrpShp, SrcText, DestText\r\n      Next\r\n    Else\r\n      ReplaceShapeText Shp, SrcText, DestText\r\n    End If\r\n  Next\r\nEnd Sub\r\n\r\nPrivate Sub ReplaceShapeText(ByVal Shp As Shape, ByVal SrcText As String, ByVal DestText As String)\r\n  If Shp.TextFrame.HasText Then\r\n    '\u691c\u7d22\u6761\u4ef6\u306f\u9069\u5f53\u306b\u8a2d\u5b9a\r\n    With Shp.TextFrame.TextRange.Find\r\n      .ClearFormatting\r\n      .Forward = True\r\n      .Text = SrcText\r\n      .Replacement.Text = DestText\r\n      .Execute Replace:=wdReplaceAll\r\n    End With\r\n  End If\r\nEnd Sub<\/pre>\n<p>\u65b0\u7530\u3055\u3093\u306e\u30de\u30af\u30ed\u3067\u306fSelection\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u4e0a\u8a18\u30b3\u30fc\u30c9\u3067\u306f\u3001Shape\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eTextFrame\u30d7\u30ed\u30d1\u30c6\u30a3(TextFrame\u30aa\u30d6\u30b8\u30a7\u30af\u30c8)\u306b\u3042\u308bTextRange\u30d7\u30ed\u30d1\u30c6\u30a3\u304b\u3089Range\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3001\u3053\u308c\u3092\u5229\u7528\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u63cf\u753b\u30ad\u30e3\u30f3\u30d0\u30b9\u3068\u30b0\u30eb\u30fc\u30d7\u5316\u3055\u308c\u305f\u30a2\u30a4\u30c6\u30e0\u3060\u3051\u306f\u8003\u616e\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u308c\u4ee5\u5916\u306f\u7279\u5225\u306a\u51e6\u7406\u3092\u3057\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3001\u4e0a\u8a18\u30b3\u30fc\u30c9\u3067\u306f\u5bfe\u5fdc\u3067\u304d\u306a\u3044\u5834\u5408\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>Shape\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u4e2d\u3005\u51fa\u756a\u304c\u7121\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3053\u3046\u3044\u3063\u305f\u30de\u30af\u30ed\u3082\u9762\u767d\u3044\u3067\u3059\u306d(^^)<\/p>\n","protected":false},"excerpt":{"rendered":"Word MVP\u306e\u65b0\u7530\u3055\u3093\u306e\u30d6\u30ed\u30b0\u3067\u6c17\u306b\u306a\u308b\u8a18\u4e8b\u304c\u3042\u308a\u307e\u3057\u305f\u3002 &#8220;\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u5185\u306e\u6587\u5b57\u3092\u7f6e\u63db\u3059\u308b\u30de\u30af\u30ed&#8221; \u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u7b49Shape\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30c6\u30ad\u30b9\u30c8\u306e\u307f\u3092\u7f6e\u63db\u3059\u308bWord\u30de\u30af\u30ed\u3067\u3059\u3002  [&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":[11,45,85],"class_list":["post-859","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-word-office","tag-office-2","tag-word-","tag-word-vba-2"],"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-dR","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/859","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=859"}],"version-history":[{"count":8,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/859\/revisions"}],"predecessor-version":[{"id":2240,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/859\/revisions\/2240"}],"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=859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}