{"id":10678,"date":"2018-07-30T12:00:42","date_gmt":"2018-07-30T03:00:42","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=10678"},"modified":"2018-07-30T13:17:40","modified_gmt":"2018-07-30T04:17:40","slug":"%e3%80%902018%e5%b9%b47%e6%9c%88%e7%89%88%e3%80%91%e3%82%bd%e3%83%bc%e3%82%b9%e3%82%b3%e3%83%bc%e3%83%89%e3%82%92%e7%95%aa%e5%8f%b7%e8%a1%8c%e4%bb%98%e3%81%8d%e3%81%ae%e3%83%86%e3%83%bc%e3%83%96","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=10678","title":{"rendered":"\u30102018\u5e747\u6708\u7248\u3011\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"},"content":{"rendered":"<p>6\u5e74\u4ee5\u4e0a\u524d\u3001Word\u306b\u8cbc\u308a\u4ed8\u3051\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u756a\u53f7\u4ed8\u304d\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5909\u63db\u3059\u308b\u30de\u30af\u30ed\u3092\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=1183\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Word-120x120.png' alt='\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' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2012.01.16<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=1183\">\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><\/div><div class=\"cardlink_excerpt\">Word\u6587\u66f8\u5185\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u3001\u4ed6\u306e\u6587\u66f8\u3068\u533a\u5225\u3057\u3066\u76ee\u7acb\u305f\u305b\u305f\u3044\u3068\u304d\u306b\u5f79\u7acb\u3064\u30de\u30af\u30ed\u3067\u3059\u3002\r\n\r\n\u4e0b\u56f3\u306e\u3088\u3046\u306a\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u3042\u3063\u305f\u3068\u304d\u3001\u30b3\u30fc\u30c9\u90e8\u5206\u3092\u9078\u629e\u3057\u3066\u30de\u30af\u30ed\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\r\n\r\n\r\n\r\n\u4e0b\u56f3\u306e\u3088\u3046\u306b\u756a\u53f7\u884c\u4ed8\u304d\u306e\u30c6\u30fc\u30d6\u30eb\u3078\u3068\u5909\u63db\u3055\u308c\u308b\u306e\u3067\u3001\u4e00\u76ee\u3067\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3060...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<p>\u6539\u3081\u3066\u4f7f\u3063\u3066\u307f\u308b\u3068\u3001\u4e00\u90e8\u4f7f\u7528\u3092\u5909\u3048\u305f\u65b9\u304c\u4f7f\u3044\u3084\u3059\u304f\u306a\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u3001\u30de\u30af\u30ed\u3092\u66f8\u304d\u76f4\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u4e0b\u8a18\u30b3\u30fc\u30c9\u3067\u5909\u63db\u3055\u308c\u308b\u30c6\u30fc\u30d6\u30eb\u306e\u66f8\u5f0f\u306f\u3001\u30e2\u30ce\u30af\u30ed\u5370\u5237\u3092\u60f3\u5b9a\u3057\u305f\u3082\u306e\u3067\u3059\u3002<br \/>\n\u6587\u5b57\u8272\u3084\u30b5\u30a4\u30ba\u3001\u7f6b\u7dda\u306e\u7dda\u7a2e\u7b49\u3001\u81ea\u5206\u306e\u597d\u307f\u306b\u5408\u308f\u305b\u3066\u9069\u5f53\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Public Sub SourceCodeToTable()\r\n'\u9078\u629e\u3057\u3066\u3044\u308b\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u8868\u5f62\u5f0f\u3067\u51fa\u529b\r\n  Dim tbl As Word.Table\r\n  Dim ur As Word.UndoRecord\r\n  Dim str As String\r\n  Dim v As Variant\r\n  Dim i As Long\r\n  Dim w As Single\r\n  \r\n  If ChkCondition = False Then\r\n    MsgBox &quot;\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u9078\u629e\u3057\u305f\u72b6\u614b\u3067\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;, vbExclamation + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  \r\n  Application.ScreenUpdating = False\r\n  Set ur = Application.UndoRecord\r\n  ur.StartCustomRecord &quot;\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u5909\u63db\u51e6\u7406&quot;\r\n  On Error GoTo Err:\r\n  \r\n  '\u6700\u5f8c\u306e\u6539\u884c\u3092\u9078\u629e\u7bc4\u56f2\u304b\u3089\u5916\u3059\r\n  Select Case AscW(Selection.Characters.Last)\r\n    Case &amp;HB, &amp;HD: Selection.MoveEnd wdCharacter, -1\r\n  End Select\r\n  \r\n  str = Selection.Text\r\n  str = Replace(str, ChrW(&amp;HB), ChrW(&amp;HD)) '\u6bb5\u843d\u5185\u6539\u884c\u7f6e\u63db\r\n  v = Split(str, ChrW(&amp;HD))\r\n  Set tbl = Selection.Tables.Add(Selection.Range, UBound(v) + 1, 2)\r\n \r\n  '\u30d5\u30a9\u30f3\u30c8\u8a2d\u5b9a\r\n  With tbl.Range.Font\r\n    .Size = 10\r\n    .NameFarEast = &quot;\uff2d\uff33 \u30b4\u30b7\u30c3\u30af&quot;\r\n    .NameAscii = &quot;\uff2d\uff33 \u30b4\u30b7\u30c3\u30af&quot;\r\n    .NameOther = &quot;\uff2d\uff33 \u30b4\u30b7\u30c3\u30af&quot;\r\n    .Bold = False\r\n    .Italic = False\r\n    .Underline = wdUnderlineNone\r\n    .UnderlineColor = wdColorAutomatic\r\n    .StrikeThrough = False\r\n    .DoubleStrikeThrough = False\r\n    .Outline = False\r\n    .Emboss = False\r\n    .Shadow = False\r\n    .Hidden = False\r\n    .SmallCaps = False\r\n    .AllCaps = False\r\n    .Color = wdColorAutomatic\r\n    .Engrave = False\r\n    .Superscript = False\r\n    .Subscript = False\r\n  End With\r\n \r\n  '\u6bb5\u843d\u8a2d\u5b9a\r\n  With tbl.Range.ParagraphFormat\r\n    .LineSpacingRule = wdLineSpaceSingle '\u884c\u9593\uff1a1\u884c\r\n    .WordWrap = False '&#x5B;\u82f1\u5358\u8a9e\u306e\u9014\u4e2d\u3067\u6539\u884c\u3059\u308b]\u306b\u30c1\u30a7\u30c3\u30af\r\n  End With\r\n \r\n  For i = LBound(v) To UBound(v)\r\n    tbl.Cell(i + 1, 1).Range.Text = i + 1\r\n    tbl.Cell(i + 1, 2).Range.Text = v(i)\r\n  Next\r\n \r\n  '\u5e45\u8a2d\u5b9a\r\n  tbl.AutoFitBehavior wdAutoFitWindow\r\n  w = tbl.Columns(1).Width + tbl.Columns(2).Width\r\n  tbl.Columns(1).Width = 35\r\n  tbl.Columns(2).Width = w - 35\r\n \r\n  '\u914d\u7f6e\u8a2d\u5b9a\r\n  tbl.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenter\r\n  tbl.Range.ParagraphFormat.Alignment = wdAlignParagraphJustify\r\n \r\n  '\u7f6b\u7dda\u8a2d\u5b9a\r\n  With tbl.Borders\r\n    .OutsideColor = wdColorAutomatic\r\n    .OutsideLineStyle = wdLineStyleSingle\r\n    .OutsideLineWidth = wdLineWidth050pt\r\n  End With\r\n  With tbl.Borders(wdBorderHorizontal)\r\n    .Color = wdColorAutomatic\r\n    .LineStyle = wdLineStyleDot\r\n    .LineWidth = wdLineWidth050pt\r\n  End With\r\n  With tbl.Columns(1).Borders(wdBorderRight)\r\n    .Color = wdColorAutomatic\r\n    .LineStyle = wdLineStyleSingle\r\n    .LineWidth = wdLineWidth050pt\r\n  End With\r\n  \r\n  '\u80cc\u666f\u8272\u8a2d\u5b9a\r\n  With tbl.Shading\r\n    .Texture = wdTextureNone\r\n    .ForegroundPatternColor = wdColorAutomatic\r\n    .BackgroundPatternColor = &amp;HDC00F2FF\r\n  End With\r\n  \r\n  '\u884c\u756a\u53f7\u5217\u66f8\u5f0f\u8a2d\u5b9a\r\n  tbl.Columns(1).Shading.BackgroundPatternColor = &amp;H333333\r\n  tbl.Columns(1).Select\r\n  Selection.Font.Color = &amp;HFFFFFF\r\n  Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter\r\n  Selection.Collapse wdCollapseStart\r\n  \r\nErr:\r\n  If Not ur Is Nothing Then\r\n    If ur.IsRecordingCustomRecord = True Then ur.EndCustomRecord\r\n  End If\r\n  Application.ScreenUpdating = True\r\nEnd Sub\r\n\r\nPrivate Function ChkCondition() As Boolean\r\n'\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u304c\u5b9f\u884c\u3067\u304d\u308b\u72b6\u6cc1\u306a\u306e\u304b\u3092\u78ba\u8a8d\r\n  Dim ret As Boolean\r\n  Dim chrs As Variant\r\n  Dim tmp As String\r\n  Dim i As Long\r\n  \r\n  ret = True '\u521d\u671f\u5316\r\n  If Selection.Type &lt;&gt; wdSelectionNormal Then ret = False '\u30c6\u30ad\u30b9\u30c8\u304c\u9078\u629e\u72b6\u614b\u306b\u3042\u308b\u304b\u3092\u78ba\u8a8d\r\n  tmp = Selection.Text\r\n  '\u6539\u884c\u3068\u7a7a\u767d\u6587\u5b57\u306e\u30b3\u30fc\u30c9\r\n  '\u7a7a\u767d\uff1a http:\/\/en.wikipedia.org\/wiki\/Space_%28punctuation%29 \u53c2\u7167\r\n  chrs = Array(&amp;HB, &amp;HD, &amp;H20, &amp;HA0, &amp;H1680, &amp;H180E, &amp;H2000, &amp;H2001, &amp;H2002, &amp;H2003, _\r\n    &amp;H2004, &amp;H2005, &amp;H2006, &amp;H2007, &amp;H2008, &amp;H2009, &amp;H200A, &amp;H200B, &amp;H200C, &amp;H200D, _\r\n    &amp;H202F, &amp;H205F, &amp;H2060, &amp;H3000, &amp;HFEFF)\r\n  For i = LBound(chrs) To UBound(chrs)\r\n    tmp = Replace(tmp, ChrW(chrs(i)), &quot;&quot;)\r\n  Next\r\n  If Len(tmp) &lt; 1 Then ret = False\r\n  ChkCondition = ret\r\nEnd Function<\/pre>\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u9078\u629e\u3057\u305f\u72b6\u614b\u3067\u4e0a\u8a18\u30de\u30af\u30ed\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u4e0b\u56f3\u306e\u3088\u3046\u306b\u884c\u756a\u53f7\u4ed8\u304d\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5909\u63db\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_01.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_01.gif\" alt=\"\" width=\"762\" height=\"719\" class=\"alignnone size-full wp-image-10679\" \/><\/a><\/p>\n<p><a href=\"https:\/\/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 | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\u4ee5\u524d\u306e\u30de\u30af\u30ed<\/a>\u3068\u306e\u5927\u304d\u306a\u9055\u3044\u306f\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306b\u6298\u308a\u8fd4\u3055\u308c\u3066\u3044\u308b\u884c\u3082\u4e00\u884c\u3068\u3057\u3066\u3044\u308b\u70b9\u3068\u3001<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/vba\/word-vba\/articles\/working-with-the-undorecord-object\" title=\"UndoRecord \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u7528\u3059\u308b\" target=\"_blank\">UndoRecord<\/a>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u3046\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u30de\u30af\u30ed\u3067\u884c\u3063\u3066\u3044\u308b\u4e00\u9023\u306e\u8868\u5316\u51e6\u7406\u3092\u5f8c\u304b\u3089\u4e00\u62ec\u3067\u5143\u306b\u623b\u305b\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u70b9\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_02.jpg\" alt=\"\" width=\"738\" height=\"343\" class=\"alignnone size-full wp-image-10680\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_02.jpg 738w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_02-300x139.jpg 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_03.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_03.jpg\" alt=\"\" width=\"302\" height=\"146\" class=\"alignnone size-full wp-image-10681\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_03.jpg 302w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/Source2Table_02_03-300x145.jpg 300w\" sizes=\"auto, (max-width: 302px) 100vw, 302px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/VBA\/Word-VBA\/articles\/undorecord-object-word\" title=\"UndoRecord \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 (Word)\" target=\"_blank\">UndoRecord<\/a>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001Word 2010\u3067\u8ffd\u52a0\u3055\u308c\u305f\u6a5f\u80fd\u3067\u3042\u308b\u305f\u3081\u3001\u305d\u308c\u4ee5\u524d\u306eWord\u3067\u306f\u52d5\u4f5c\u3057\u307e\u305b\u3093\u304c\u3001\u4f7f\u3044\u65b9\u306b\u3088\u3063\u3066\u306f\u975e\u5e38\u306b\u4fbf\u5229\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3059\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"6\u5e74\u4ee5\u4e0a\u524d\u3001Word\u306b\u8cbc\u308a\u4ed8\u3051\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u756a\u53f7\u4ed8\u304d\u306e\u30c6\u30fc\u30d6\u30eb\u306b\u5909\u63db\u3059\u308b\u30de\u30af\u30ed\u3092\u66f8\u304d\u307e\u3057\u305f\u3002 \u6539\u3081\u3066\u4f7f\u3063\u3066\u307f\u308b\u3068\u3001\u4e00\u90e8\u4f7f\u7528\u3092\u5909\u3048\u305f\u65b9\u304c\u4f7f\u3044\u3084\u3059\u304f\u306a\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u3001\u30de\u30af\u30ed\u3092\u66f8\u304d\u76f4\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u4e0b\u8a18\u30b3\u30fc\u30c9\u3067\u5909\u63db\u3055\u308c [&hellip;]","protected":false},"author":1,"featured_media":7136,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[\u30102018\u5e747\u6708\u7248\u3011\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]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,49],"tags":[],"class_list":["post-10678","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-WordVBA.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-2Me","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10678","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=10678"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10678\/revisions"}],"predecessor-version":[{"id":10682,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/10678\/revisions\/10682"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7136"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}