{"id":1191,"date":"2012-01-16T16:30:17","date_gmt":"2012-01-16T07:30:17","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=1191"},"modified":"2013-08-20T23:45:49","modified_gmt":"2013-08-20T14:45:49","slug":"%e3%82%bb%e3%83%ab%e3%81%ae%e8%a1%8c%e6%95%b0%e3%82%92%e3%82%ab%e3%82%a6%e3%83%b3%e3%83%88%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=1191","title":{"rendered":"\u30bb\u30eb\u306e\u884c\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308bWord\u30de\u30af\u30ed"},"content":{"rendered":"<p>\u300c<a href=\"\/\/www.ka-net.org\/blog\/?p=1183\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u756a\u53f7\u884c\u4ed8\u304d\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5909\u63db\u3059\u308bWord\u30de\u30af\u30ed\" target=\"_blank\">\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u756a\u53f7\u884c\u4ed8\u304d\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5909\u63db\u3059\u308bWord\u30de\u30af\u30ed<\/a>\u300d\u3092\u5b9f\u884c\u3057\u305f\u3068\u304d\u3001\u300c<strong>GetCellLines<\/strong>\u300dFunction\u304c\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002<br \/>\n\u3053\u306eFunction\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306b\u3088\u3063\u3066\u30bb\u30eb\u306e\u884c\u6570\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u79c1\u304c\u30bb\u30eb\u306e\u884c\u6570\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u8a66\u884c\u932f\u8aa4\u3057\u305f\u7d50\u679c\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<p>\u307e\u305a\u3001\u884c\u6570\u3092\u6c42\u3081\u308b\u65b9\u6cd5\u3068\u3057\u3066\u3059\u3050\u306b\u601d\u3044\u6d6e\u304b\u3076\u306e\u306f&#8221;<strong>\u5bfe\u8c61\u30bb\u30eb\u3067\u4f55\u56de\u6539\u884c\u3055\u308c\u3066\u3044\u308b\u306e\u304b\uff1f<\/strong>&#8220;\u3092\u8abf\u3079\u308b\u65b9\u6cd5\u3067\u3001\u3053\u308c\u304c\u5206\u304b\u308c\u3070\u3059\u3050\u306b\u884c\u6570\u304c\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<br \/>\n\u30b3\u30fc\u30c9\u3068\u3057\u3066\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Public Sub Sample()\r\n  Dim s As String\r\n  \r\n  s = ActiveDocument.Tables(1).Cell(1, 2).Range.Text\r\n  Debug.Print UBound(Split(s, vbCr))\r\nEnd Sub<\/pre>\n<p>\u5bfe\u8c61\u306e\u6587\u5b57\u5217\u3092&#8221;<strong>\u6539\u884c<\/strong>&#8220;\u3067\u533a\u5207\u3063\u3066\u3001\u305d\u308c\u306b\u3088\u308a\u8fd4\u3055\u308c\u308b\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u8abf\u3079\u308b\u3060\u3051\u306e\u5358\u7d14\u306a\u30de\u30af\u30ed\u3067\u3059\u3002<br \/>\n\u3053\u306e\u30de\u30af\u30ed\u3092\u4e0b\u56f3\u306e\u3088\u3046\u306a\u30c6\u30fc\u30d6\u30eb\u3092\u5bfe\u8c61\u306b\u5b9f\u884c\u3059\u308b\u3068\u3001Debug.Print\u3067&#8221;<strong>4<\/strong>&#8220;\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetCellLines_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetCellLines_01.jpg\" alt=\"\" title=\"GetCellLines_01\" width=\"201\" height=\"112\" class=\"alignnone size-full wp-image-1192\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetCellLines_01.jpg 201w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetCellLines_01-150x83.jpg 150w\" sizes=\"auto, (max-width: 201px) 100vw, 201px\" \/><\/a><\/p>\n<p>\u4e00\u898b\u554f\u984c\u304c\u7121\u3044\u3088\u3046\u306b\u898b\u3048\u307e\u3059\u304c\u3001\u3053\u306e\u30de\u30af\u30ed\u3092\u4e0b\u56f3\u306e\u3088\u3046\u306a\u30c6\u30fc\u30d6\u30eb\u3092\u5bfe\u8c61\u306b\u5b9f\u884c\u3059\u308b\u3068\u3001\u4e0a\u56f3\u306e\u5834\u5408\u3068\u540c\u3058\u304f&#8221;<strong>4<\/strong>&#8220;\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<br \/>\n\u7d50\u679c\u3092\u898b\u308c\u3070\u5206\u304b\u308b\u901a\u308a\u3001&#8221;<strong>\u6539\u884c\u306e\u500b\u6570<\/strong>&#8220;\u3067\u5224\u65ad\u3057\u3066\u3044\u308b\u305f\u3081\u306b<span style=\"color: #ff0000; font-weight: bold;\">\u6587\u5b57\u5217\u306e\u6298\u308a\u8fd4\u3057\u306b\u306f\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044<\/span>\u308f\u3051\u3067\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetCellLines_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetCellLines_02.jpg\" alt=\"\" title=\"GetCellLines_02\" width=\"202\" height=\"137\" class=\"alignnone size-full wp-image-1193\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetCellLines_02.jpg 202w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetCellLines_02-150x101.jpg 150w\" sizes=\"auto, (max-width: 202px) 100vw, 202px\" \/><\/a><\/p>\n<p>\u6b21\u306b\u8003\u3048\u305f\u306e\u304c\u3001\u30bb\u30eb\u306e\u6700\u521d\u306e\u884c\u756a\u53f7\u3068\u6700\u5f8c\u306e\u884c\u756a\u53f7\u306e\u5dee\u304b\u3089\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<br \/>\n\u30b3\u30fc\u30c9\u3068\u3057\u3066\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Public Sub Sample2()\r\n  Dim fln As Long, lln As Long\r\n  \r\n  ActiveDocument.Tables(1).Cell(1, 2).Select\r\n  Selection.StartOf wdCell, wdMove\r\n  fln = Selection.Information(wdFirstCharacterLineNumber)\r\n  Selection.EndOf wdCell, wdMove\r\n  lln = Selection.Information(wdFirstCharacterLineNumber)\r\n  Debug.Print lln - fln + 1\r\nEnd Sub<\/pre>\n<p><strong>StartOf<\/strong>\u30e1\u30bd\u30c3\u30c9\u306b\u3088\u3063\u3066\u30bb\u30eb\u306e\u6700\u521d\u306b\u30ab\u30fc\u30bd\u30eb\u3092\u79fb\u52d5\u3057\u3066\u884c\u756a\u53f7\u3092\u53d6\u5f97\u3001<strong>EndOf<\/strong>\u30e1\u30bd\u30c3\u30c9\u306b\u3088\u3063\u3066\u30bb\u30eb\u306e\u6700\u5f8c\u306b\u30ab\u30fc\u30bd\u30eb\u3092\u79fb\u52d5\u3057\u3066\u884c\u756a\u53f7\u3092\u53d6\u5f97\u3001\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u6700\u521d\u306e\u884c\u756a\u53f7\u3068\u6700\u5f8c\u306e\u884c\u756a\u53f7\u304c\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3001\u3042\u3068\u306f\u5dee\u3092\u8a08\u7b97\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u4e0a\u56f3\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3057\u3066\u6539\u3081\u3066\u30de\u30af\u30ed\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4eca\u5ea6\u306f\u3061\u3083\u3093\u3068&#8221;<strong>5<\/strong>&#8220;\u304c\u51fa\u529b\u3055\u308c\u3001\u6587\u5b57\u5217\u306e\u6298\u308a\u8fd4\u3057\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3088\u3046\u306b\u898b\u3048\u307e\u3059\u3002<br \/>\n\u3067\u3059\u304c\u3001\u3053\u306e\u30de\u30af\u30ed\u3092\u4f55\u56de\u304b\u8a66\u3057\u3066\u3044\u308b\u3068\u3001\u30bb\u30eb\u5185\u306e\u884c\u6570\u304c\u591a\u3044\u5834\u5408\u306f\u4f55\u6545\u304b&#8221;0&#8243;\u304c\u8fd4\u3063\u3066\u304d\u305f\u308a\u3001\u30bb\u30eb\u304c\u8907\u6570\u30da\u30fc\u30b8\u306b\u307e\u305f\u304c\u308b\u5834\u5408\u306f\u6b63\u78ba\u306a\u884c\u6570\u304c\u53d6\u5f97\u3067\u304d\u306a\u304b\u3063\u305f\u308a\u3068\u3001\u610f\u56f3\u3059\u308b\u7d50\u679c\u306b\u306f\u306a\u3089\u306a\u3044\u5834\u5408\u304c\u591a\u3005\u3042\u308b\u3053\u3068\u306b\u6c17\u304c\u4ed8\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3053\u3067\u6700\u7d42\u7684\u306b\u79c1\u304c\u53d6\u3063\u305f\u65b9\u6cd5\u304c\u4e0b\u8a18\u3088\u3046\u306a\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Private Function GetCellLines(ByVal tbl As Word.Table) As Long\r\n'\u30bb\u30eb\u306e\u884c\u6570\u30ab\u30a6\u30f3\u30c8\r\n  Dim ln As Long\r\n  \r\n  ln = 0 '\u521d\u671f\u5316\r\n  tbl.Columns(2).Cells(1).Range.Select\r\n  Selection.StartOf wdCell, wdMove\r\n  Do While Selection.Information(wdWithInTable)\r\n    ln = ln + 1\r\n    Selection.MoveDown wdLine, 1, wdMove\r\n  Loop\r\n  GetCellLines = ln\r\nEnd Function<\/pre>\n<p>\u30bb\u30eb\u306e\u6700\u521d\u306e\u884c\u306b\u30ab\u30fc\u30bd\u30eb\u3092\u79fb\u52d5\u3057\u3001&#8221;<strong>\u30ab\u30fc\u30bd\u30eb\u304c\u30c6\u30fc\u30d6\u30eb\u3092\u629c\u3051\u308b\u307e\u30671\u884c\u4e0b\u306b\u30ab\u30fc\u30bd\u30eb\u3092\u79fb\u52d5\u3055\u305b\u308b<\/strong>&#8220;\u51e6\u7406\u3092\u5b9f\u884c\u3057\u3001\u4f55\u56de\u30ab\u30fc\u30bd\u30eb\u304c\u4e0b\u306b\u79fb\u52d5\u3057\u305f\u306e\u304b\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u3068\u3044\u3046\u3001\u4f55\u3068\u3082\u6ce5\u81ed\u3044\u3082\u306e\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u6c17\u6301\u3061\u7684\u306b\u4f55\u304b\u3059\u3063\u304d\u308a\u3057\u306a\u3044\u3082\u306e\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u4e00\u5fdc\u306f\u3053\u308c\u3067\u4e8b\u304c\u8db3\u308a\u307e\u3059\u3002<br \/>\n\u4eca\u5f8c\u3001\u3082\u3063\u3068\u52b9\u7387\u306e\u826f\u3044\u51e6\u7406\u3092\u601d\u3044\u3064\u3044\u305f\u3068\u304d\u306f\u3001\u305d\u3061\u3089\u306e\u65b9\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u63db\u3048\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u300c\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u756a\u53f7\u884c\u4ed8\u304d\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5909\u63db\u3059\u308bWord\u30de\u30af\u30ed\u300d\u3092\u5b9f\u884c\u3057\u305f\u3068\u304d\u3001\u300cGetCellLines\u300dFunction\u304c\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002 \u3053\u306eFunction\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306b\u3088\u3063\u3066\u30bb\u30eb\u306e\u884c\u6570\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u56de [&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-1191","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-jd","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1191","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=1191"}],"version-history":[{"count":5,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1191\/revisions"}],"predecessor-version":[{"id":2237,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1191\/revisions\/2237"}],"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=1191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}