{"id":5538,"date":"2015-04-22T13:16:50","date_gmt":"2015-04-22T04:16:50","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=5538"},"modified":"2015-04-22T13:16:50","modified_gmt":"2015-04-22T04:16:50","slug":"%e3%80%8cexcel-vba-%e6%a5%ad%e5%8b%99%e8%87%aa%e5%8b%95%e5%8c%96-%e4%bb%95%e4%ba%8b%e3%81%ae%e5%8a%b9%e7%8e%87%e3%82%92%e5%8a%87%e7%9a%84%e3%81%ab%e4%b8%8a%e3%81%92%e3%82%8b%e3%83%8e%e3%82%a6%e3%83%8f","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=5538","title":{"rendered":"\u300cEXCEL VBA \u696d\u52d9\u81ea\u52d5\u5316 \u4ed5\u4e8b\u306e\u52b9\u7387\u3092\u5287\u7684\u306b\u4e0a\u3052\u308b\u30ce\u30a6\u30cf\u30a6\u300d\u30ec\u30d3\u30e5\u30fc"},"content":{"rendered":"<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b \u4e0b\u8a18\u30ec\u30d3\u30e5\u30fc\u306f\u3042\u304f\u307e\u3067\u3082\u500b\u4eba\u7684\u306a\u611f\u60f3\u3067\u3059\u3002<\/span><\/p>\n<p>2015\u5e744\u670817\u65e5\u306b\u767a\u58f2\u3055\u308c\u305f\u300c<a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4798139378\/ref=as_li_qf_sp_asin_tl?ie=UTF8&#038;camp=247&#038;creative=1211&#038;creativeASIN=4798139378&#038;linkCode=as2&#038;tag=kinuasa-22\">EXCEL VBA \u696d\u52d9\u81ea\u52d5\u5316 [\u30d3\u30b8\u30c6\u30af] \u4ed5\u4e8b\u306e\u52b9\u7387\u3092\u5287\u7684\u306b\u4e0a\u3052\u308b\u30ce\u30a6\u30cf\u30a6 2013\/2010\/2007\u5bfe\u5fdc<\/a><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/\/HLIC\/accba0b69f352b4c9440f05891b015c5.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" style=\"border:none !important; margin:0px !important;\" \/>\u300d\u3092\u65e9\u901f\u8cfc\u5165\u3057\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4798139378\/ref=as_li_qf_sp_asin_il?ie=UTF8&#038;camp=247&#038;creative=1211&#038;creativeASIN=4798139378&#038;linkCode=as2&#038;tag=kinuasa-22\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&#038;ASIN=4798139378&#038;Format=_SL160_&#038;ID=AsinImage&#038;MarketPlace=JP&#038;ServiceVersion=20070822&#038;WS=1&#038;tag=kinuasa-22\" ><\/a><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/\/HLIC\/accba0b69f352b4c9440f05891b015c5.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" style=\"border:none !important; margin:0px !important;\" \/><\/p>\n<p>\u4f5c\u8005\u306fExcel MVP\u3067\u3042\u308a\u201c<a href=\"http:\/\/www.geocities.co.jp\/SiliconValley-Cupertino\/8748\/ugokasu.htm\" title=\"\u52d5\u304b\u3059\u4f1a\" target=\"_blank\">\u52d5\u304b\u3059\u4f1a<\/a>\u201d\u4f1a\u9577\u3068\u3057\u3066\u6709\u540d\u306a<a href=\"http:\/\/www1.plala.or.jp\/chikada\/\" title=\"VBA\u30a2\u30af\u30b7\u30e7\u30f3\u30b2\u30fc\u30e0\uff1fExcel\uff08\u30a8\u30af\u30bb\u30eb\uff09\u3067\u52d5\u304b\u305d\u3046\uff01\" target=\"_blank\">\u8fd1\u7530\u4f38\u77e2<\/a>\u6c0f\u3068\u3001\u540c\u3058\u304fExcel MVP\u3067\u3042\u308a\u300c<a href=\"http:\/\/vbae.odyssey-com.co.jp\/column\/index.html\" title=\"\u3084\u3063\u3066\u307f\u3088\u3046\uff01Excel VBA\u3067\u696d\u52d9\u6539\u5584\uff01\uff5cVBA\u30a8\u30ad\u30b9\u30d1\u30fc\u30c8\u516c\u5f0f\u30b5\u30a4\u30c8\" target=\"_blank\">\u3084\u3063\u3066\u307f\u3088\u3046\uff01Excel VBA\u3067\u696d\u52d9\u6539\u5584\uff01<\/a>\u300d\u306e\u4f5c\u8005\u3067\u3082\u3042\u308b<a href=\"http:\/\/home.att.ne.jp\/zeta\/gen\/\" title=\"\u6b66\u85e4\u7384\u30aa\u30d5\u30a3\u30b7\u30e3\u30eb\u30b5\u30a4\u30c8-GEN MUTO'S HOMEPAGE-\" target=\"_blank\">\u6b66\u85e4\u7384<\/a>\u6c0f\u3001\u305d\u3057\u3066\u6570\u3005\u306eExcel\u66f8\u7c4d\u306e\u8457\u8005\u3068\u3057\u3066\u77e5\u3089\u308c\u308b<a href=\"https:\/\/twitter.com\/fmajin\" title=\"\u65e9\u5742\u6e05\u5fd7(@fmajin)\u3055\u3093 | Twitter\" target=\"_blank\">\u65e9\u5742\u6e05\u5fd7<\/a>\u6c0f\u306e\u4e09\u540d\u3067\u3001\u672c\u66f8\u306e\u6982\u8981\u3084\u76ee\u6b21\u3001\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u4e0b\u8a18\u30da\u30fc\u30b8\u304b\u3089\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>\u30fbEXCEL VBA \u696d\u52d9\u81ea\u52d5\u5316 \uff3b\u30d3\u30b8\u30c6\u30af\uff3d \u4ed5\u4e8b\u306e\u52b9\u7387\u3092\u5287\u7684\u306b\u4e0a\u3052\u308b\u30ce\u30a6\u30cf\u30a6 2013\/2010\/2007\u5bfe\u5fdc\uff08\u8fd1\u7530\u4f38\u77e2 \u65e9\u5742\u6e05\u5fd7 \u6b66\u85e4\u7384\uff09<\/strong><br \/>\n<a href=\"http:\/\/www.shoeisha.co.jp\/book\/detail\/9784798139371\" title=\"EXCEL VBA \u696d\u52d9\u81ea\u52d5\u5316 \uff3b\u30d3\u30b8\u30c6\u30af\uff3d \u4ed5\u4e8b\u306e\u52b9\u7387\u3092\u5287\u7684\u306b\u4e0a\u3052\u308b\u30ce\u30a6\u30cf\u30a6 2013\/2010\/2007\u5bfe\u5fdc\uff08\u8fd1\u7530\u4f38\u77e2 \u65e9\u5742\u6e05\u5fd7 \u6b66\u85e4\u7384\uff09 \uff5c \u7fd4\u6cf3\u793e\u306e\u672c\" target=\"_blank\">http:\/\/www.shoeisha.co.jp\/book\/detail\/9784798139371<\/a><\/p>\n<h4 class=\"style4a\">\u8aad\u3093\u3067\u826f\u304b\u3063\u305f\u3068\u601d\u3046\u70b9<\/h4>\n<p>\u672c\u66f8\u306f\u3001Excel\u3001\u7279\u306bVBA\u754c\u9688\u3067\u306f\u77e5\u3089\u306a\u3044\u4eba\u306f\u3044\u306a\u3044\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3046\u304f\u3089\u3044\u306e\u8c6a\u83ef\u306a3\u540d\u306b\u3088\u308b\u5171\u8457\u3067\u3059\u3002<\/p>\n<p>\u30bf\u30a4\u30c8\u30eb\u306e\u901a\u308a\u3001\u672c\u66f8\u306f\u4ed5\u4e8b\u306e\u52b9\u7387\u5316\u306b\u91cd\u70b9\u304c\u7f6e\u304b\u308c\u3066\u3044\u3066\u3001\u696d\u52d9\u3067\u3042\u308a\u304c\u3061\u306a\u51e6\u7406\u3092\u30de\u30af\u30ed\u3084Excel\u306e\u6a19\u6e96\u6a5f\u80fd\u306b\u3088\u3063\u3066\u4f5c\u696d\u52b9\u7387\u3092\u4e0a\u3052\u308b\u3001\u3042\u308b\u3044\u306f\u81ea\u52d5\u5316\u3092\u884c\u3046\u305f\u3081\u306e\u624b\u6cd5\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e0a\u8a18\u30ea\u30f3\u30af\u5148\u306e\u76ee\u6b21\u306b\u3082\u3042\u308b\u901a\u308a\u3001<span style=\"color: #ff0000; font-weight: bold;\">Outlook\u3084Access\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9(mdb,accdb)\u3068\u306e\u9023\u643a\u3001\u696d\u52d9\u306b\u304a\u3051\u308b\u30e6\u30fc\u30b6\u30fc\u30d5\u30a9\u30fc\u30e0\u306e\u6d3b\u7528\u65b9\u6cd5\u306a\u3069\u3001\u5e45\u5e83\u3044\u5185\u5bb9\u306b\u3064\u3044\u3066\u53d6\u308a\u6271\u3063\u3066\u3044\u3066\u3001<\/span>\u4e00\u898b\u3059\u308b\u3068\u30de\u30af\u30ed\u521d\u5fc3\u8005\u306e\u65b9\u306b\u306f\u7406\u89e3\u3057\u3065\u3089\u3044\u3088\u3046\u306b\u3082\u611f\u3058\u307e\u3059\u304c\u3001\u300c\u958b\u767a\u300d\u30bf\u30d6\u306e\u8868\u793a\u65b9\u6cd5\u3084Visual Basic Editor\u306e\u958b\u304d\u65b9\u3001\u30de\u30af\u30ed\u306e\u5b9f\u884c\u65b9\u6cd5\u307e\u3067\u89e3\u8aac\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u5168\u304f\u306e\u30de\u30af\u30ed\u521d\u5fc3\u8005\u306e\u65b9\u304c\u8aad\u3093\u3067\u3082\u3001\u3042\u308b\u7a0b\u5ea6\u3064\u3044\u3066\u3044\u3051\u308b\u5185\u5bb9\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>(\u3082\u3061\u308d\u3093\u3001VBA\u30de\u30af\u30ed\u306b\u5168\u304f\u89e6\u308c\u305f\u3053\u3068\u304c\u7121\u3044\u65b9\u306b\u306f\u3001\u6b66\u85e4\u6c0f\u306e\u8457\u4f5c\u300c<a href=\"\/\/www.ka-net.org\/blog\/?p=3228\" title=\"\u300c\u30b9\u30c8\u30fc\u30ea\u30fc\u3067\u5b66\u3076 Excel VBA\u3068\u696d\u52d9\u6539\u5584\u306e\u30dd\u30a4\u30f3\u30c8\u304c\u308f\u304b\u308b\u672c\u300d\u306e\u898b\u672c\u8a8c\u3092\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002 | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\u30b9\u30c8\u30fc\u30ea\u30fc\u3067\u5b66\u3076 Excel VBA\u3068\u696d\u52d9\u6539\u5584\u306e\u30dd\u30a4\u30f3\u30c8\u304c\u308f\u304b\u308b\u672c<\/a>\u300d\u306e\u65b9\u304c\u304a\u85a6\u3081\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u30fb\u30fb\u30fb)<\/p>\n<p>\u7b2c1\u7ae0\u3067\u306f\u3001\u696d\u52d9\u306b\u304a\u3051\u308b\u30d6\u30c3\u30af\u306e\u6271\u3044\u65b9\u306e\u6ce8\u610f\u70b9\u3084\u52b9\u7387\u3088\u304f\u4f5c\u696d\u3059\u308b\u305f\u3081\u306e\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8\u30ad\u30fc\u3001VLOOKUP\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u3068\u3044\u3063\u305f\u3001\u30de\u30af\u30ed\u4ee5\u5916\u306e\u30ce\u30a6\u30cf\u30a6\u304c\u89e3\u8aac\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u30de\u30af\u30ed\u306b\u6163\u308c\u3066\u3044\u306a\u3044\u65b9\u3067\u3082\u5165\u308a\u8fbc\u307f\u3084\u3059\u3044\u5c0e\u5165\u90e8\u5206\u3068\u8a00\u3048\u307e\u3059\u3002<\/p>\n<p>\u7b2c2\u7ae0\u304b\u3089\u306f\u5b9f\u8df5\u7684\u306aVBA\u30de\u30af\u30ed\u306e\u8aac\u660e\u304c\u7d9a\u304d\u307e\u3059\u304c\u3001\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\u306b\u306f\u8a73\u3057\u3044\u89e3\u8aac\u304c\u4ed8\u3044\u3066\u3044\u308b\u306e\u3067\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u201c\u3058\u3063\u304f\u308a\u201d<\/span>\u8aad\u3081\u3070\u3001\u30b3\u30fc\u30c9\u306e\u5404\u884c\u304c\u3069\u306e\u3088\u3046\u306a\u5f79\u5272\u3001\u52d5\u304d\u3092\u3059\u308b\u3082\u306e\u306a\u306e\u304b\u7406\u89e3\u3067\u304d\u308b\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n(\u89e3\u8aac\u90e8\u5206\u304c\u9577\u304f\u3066\u9006\u306b\u8aad\u307f\u3065\u3089\u304f\u611f\u3058\u308b\u30fb\u30fb\u30fb\u3001\u305d\u3093\u306a\u3053\u3068\u3082\u3042\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u89e3\u8aac\u304c\u5168\u304f\u7121\u3044\u3088\u308a\u306f\u826f\u3044\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u3002)<\/p>\n<p>\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u3001\u305d\u306e\u307e\u3093\u307e\u5b9f\u52d9\u3067\u4f7f\u3046\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u90e8\u5206\u7684\u306b\u66f8\u304d\u63db\u3048\u305f\u308a\u5fdc\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5b9f\u52d9\u306b\u5373\u6d3b\u304b\u305b\u305d\u3046\u3067\u3059\u3002<br \/>\n\u305d\u3046\u3044\u3063\u305f\u9762\u304b\u3089\u3082\u3001\u672c\u66f8\u306f<span style=\"color: #ff0000; font-weight: bold;\">\u201c\u696d\u52d9\u3067\u65e5\u5e38\u7684\u306bExcel\u3092\u4f7f\u3063\u3066\u3044\u308b\u5b9f\u52d9\u8005\u306e\u65b9\u5411\u304d\u306e\u672c\u201d<\/span>\u3060\u3068\u8a00\u3048\u307e\u3059\u3002<\/p>\n<h4 class=\"style4a\">\u8aad\u3093\u3067\u6c17\u306b\u306a\u3063\u305f\u70b9<\/h4>\n<p>\u672c\u66f8\u3092\u8aad\u3093\u3067\u3001\u79c1\u304c\u307e\u305a\u6c17\u306b\u306a\u3063\u305f\u70b9\u306f<span style=\"color: #ff0000; font-weight: bold;\">\u201c\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30b9\u30bf\u30a4\u30eb\u304c\u30d0\u30e9\u30d0\u30e9\u306b\u306a\u3063\u3066\u3044\u308b\u70b9\u201d<\/span>\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u5909\u6570\u306e\u540d\u3065\u3051\u65b9\u3067\u3059\u304c\u3001\u300cDim a As Object\u300d\u306e\u3088\u3046\u306b\u9069\u5f53\u306a\u540d\u524d\u306b\u306a\u3063\u3066\u3044\u305f\u308a\u3001\u300cDim myQT As QueryTable\u300d\u306e\u3088\u3046\u306b\u982d\u306b\u201cmy\u201d\u3092\u4ed8\u3051\u308b\u5f62\u306b\u306a\u3063\u3066\u3044\u305f\u308a\u3001\u300cDim UriageNo As String\u300d\u306e\u3088\u3046\u306b\u30ed\u30fc\u30de\u5b57\u8868\u8a18\u306b\u306a\u3063\u3066\u3044\u305f\u308a\u3068\u3001\u7d71\u4e00\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u578b\u306b\u3057\u3066\u3082\u3001\u3042\u308b\u7ae0\u3067\u306fVariant\u578b\u306e\u5909\u6570\u306e\u578b\u304c\u7701\u7565\u3055\u308c\u3066\u3044\u308b\u3051\u308c\u3069\u4ed6\u306e\u7ae0\u3067\u306f\u7701\u7565\u3055\u308c\u3066\u3044\u306a\u304b\u3063\u305f\u308a\u3068\u3001\u3053\u3061\u3089\u3082\u7d71\u4e00\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u308c\u306f\u8457\u8005\u306e\u65b9\u304c\u8907\u6570\u4eba\u3067\u3042\u308b\u305f\u3081\u4ed5\u65b9\u304c\u7121\u3044\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3057\u3001\u79c1\u500b\u4eba\u306e\u597d\u307f\u306e\u554f\u984c\u3067\u3082\u3042\u308a\u307e\u3059\u304c\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u8aad\u307f\u624b\u3068\u3057\u3066\u306f\u30b3\u30fc\u30c9\u306e\u66f8\u304d\u65b9\u304c\u7d71\u4e00\u3055\u308c\u3066\u3044\u305f\u65b9\u304c\u8aad\u307f\u3084\u3059\u3044<\/span>\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b\u6c17\u306b\u306a\u3063\u305f\u70b9\u306f\u3001\u4e0a\u3067\u66f8\u3044\u305f\u901a\u308a\u672c\u66f8\u306f\u5e45\u5e83\u3044\u5185\u5bb9\u306b\u3064\u3044\u3066\u53d6\u308a\u6271\u3063\u3066\u3044\u3066\u3001\u3053\u308c\u304c\u672c\u66f8\u306e\u826f\u3055\u3067\u3082\u3042\u308b\u306e\u3067\u3059\u304c\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u5e45\u5e83\u304f\u6271\u3046\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u9006\u306b\u8aac\u660e\u304c\u624b\u8584\u306b\u306a\u3063\u3066\u3044\u308b\u90e8\u5206\u304c\u3042\u308b\u70b9<\/span>\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u7b2c3\u7ae0\u3067Excel\u304b\u3089Word\u6587\u66f8\u3092\u8aad\u307f\u8fbc\u3080\u30de\u30af\u30ed\u304c\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u90e8\u5206\u3067\u306fWord\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3064\u3044\u3066\u8a73\u3057\u3044\u8aac\u660e\u304c\u8f09\u3063\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Set ObjWord = CreateObject(&quot;Word.Application&quot;) 'Word\u3092\u8d77\u52d5\u3059\u308b\r\nObjWord.Visible = True                       'Word\u3092\u8868\u793a\u3059\u308b\r\n\r\n'\u30c6\u30ad\u30b9\u30c8\u5168\u6587\u3092\u53d6\u5f97\r\nSet MyRange = ObjDoc.Range(Start:=ObjDoc.Words(1).Start, End:=ObjDoc.Words(ObjDoc.Words.Count).End)<\/pre>\n<p>Word\u30de\u30af\u30ed\u306b\u6163\u308c\u3066\u3044\u308b\u65b9\u3067\u3042\u308c\u3070\u4e0a\u8a18\u7a0b\u5ea6\u306e\u8aac\u660e\u3067\u554f\u984c\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u4e0d\u6163\u308c\u306a\u65b9\u306b\u3068\u3063\u3066\u306f\u4e0a\u8a18\u30b3\u30fc\u30c9\u306f\u7406\u89e3\u3057\u3065\u3089\u3044\u3067\u3057\u3087\u3046(\u7279\u306bExcel\u3068Word\u3001\u4e21\u65b9\u306b\u5b58\u5728\u3057\u3066\u3044\u308b\u300cRange\u300d\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u90e8\u5206)\u3002<\/p>\n<p>\u4e0a\u3067\u66f8\u3044\u305f\u901a\u308a\u3001\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306e\u89e3\u8aac\u306f\u8a73\u3057\u304f\u66f8\u304b\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u7b2c7\u7ae0\u306eOutlook\u64cd\u4f5c\u306e\u90e8\u5206\u3082\u542b\u3081\u3066\u3001<span style=\"color: #ff0000; font-weight: bold;\">Excel\u304b\u3089\u306e\u4ed6Office\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u64cd\u4f5c\u90e8\u5206\u306b\u3064\u3044\u3066\u306f\u8aac\u660e\u304c\u8db3\u308a\u306a\u3044\u3088\u3046\u306b\u611f\u3058\u307e\u3059\u3002<\/span><\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u672c\u66f8\u306f<span style=\"color: #ff0000; font-weight: bold;\">\u3042\u308b\u7a0b\u5ea6Excel\u4ee5\u5916\u306eOffice\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084VBA\u30de\u30af\u30ed\u3092\u77e5\u3063\u3066\u3044\u308b\u65b9\u304c\u8aad\u3093\u3060\u65b9\u304c\u7406\u89e3\u3057\u3084\u3059\u3044<\/span>\u3067\u3057\u3087\u3046\u3002<\/p>\n<h4 class=\"style4a\">\u91cd\u7bb1\u306e\u9685\u3092\u3064\u3064\u304f\u7684\u306a\u4f55\u304b\u3002<\/h4>\n<p>\u4ee5\u4e0b\u306f\u305d\u306e\u4ed6\u96d1\u611f\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u672a\u4f7f\u7528\u306e\u5909\u6570<\/li>\n<p>\u7b2c3\u7ae0-03\u300c\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u4efb\u610f\u306e\u884c\u3092\u62bd\u51fa\u3059\u308b\u300d\u306e\u30b3\u30fc\u30c9\u3067\u51fa\u3066\u304f\u308b\u5909\u6570\u300c<span style=\"color: #ff0000; font-weight: bold;\">MyRtn<\/span>\u300d\u3001\u3053\u308c\u306f\u4f7f\u308f\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u5ba3\u8a00\u4e0d\u8981\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<li>\u51e6\u7406\u304c\u5197\u9577\uff1f<\/li>\n<p>\u7b2c3\u7ae0-06\u300cExcel\u304b\u3089Word\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u958b\u304f\u300d\u306e\u30b3\u30fc\u30c9\u306b\u304a\u3044\u3066\u3001Word\u6587\u66f8\u306e\u30c6\u30ad\u30b9\u30c8\u53d6\u5f97\u90e8\u5206\u304c<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Set MyRange = ObjDoc.Range(Start:=ObjDoc.Words(1).Start, _\r\nEnd:=ObjDoc.Words(ObjDoc.Words.Count).End)<\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Set MyRange = ObjDoc.Range<\/pre>\n<p>\u3084<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Const wdMainTextStory = 1\r\nSet MyRange = ObjDoc.StoryRanges(wdMainTextStory)<\/pre>\n<p>\u3067\u3082\u4e8b\u8db3\u308a\u305f\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u540c\u3058\u30b3\u30fc\u30c9\u5185\u3067\u3001<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">StrText = Replace(MyRange, vbCr, vbLf)<\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u306f<span style=\"color: #ff0000; font-weight: bold;\">MyRange = Word\u306eRange\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u65e2\u5b9a\u30e1\u30f3\u30d0\u30fc\u3067\u3042\u308b\u300cText\u300d\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u7701\u7565\u3055\u308c\u3066\u3044\u308b<\/span>\u3053\u3068\u304c\u5206\u304b\u3063\u3066\u3044\u306a\u3044\u3068\u7406\u89e3\u3057\u3065\u3089\u3044\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<li>\u89aa\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u7701\u7565\u3055\u308c\u3066\u3044\u308b\u3002<\/li>\n<p>\u672c\u66f8\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306e\u591a\u304f\u306f\u300cRange(&#8220;E1&#8221;)\u300d\u300cCells(r, 1)\u300d\u306e\u3088\u3046\u306b\u3001\u89aa\u3067\u3042\u308b\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3084\u30d6\u30c3\u30af\u304c\u7701\u7565\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u7701\u7565\u3057\u306a\u3044\u3068\u30b3\u30fc\u30c9\u304c\u9577\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u4ed5\u65b9\u304c\u306a\u3044\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u300c<a href=\"http:\/\/itpro.nikkeibp.co.jp\/article\/COLUMN\/20070926\/283053\/\" title=\"Excel\/VBA\u30af\u30ea\u30cb\u30c3\u30af\uff0c\u4eca\u6708\u306e\u8a3a\u65ad - \u7b2c9\u56de \u89aa\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u7701\u7565\u3067\u304d\u306a\u3044\u7f60\uff1aITpro\" target=\"_blank\">Excel\/VBA\u30af\u30ea\u30cb\u30c3\u30af \u89aa\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u7701\u7565\u3067\u304d\u306a\u3044\u7f60<\/a>\u300d\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u554f\u984c\u3082\u3042\u308a\u307e\u3059\u3057\u3001\u500b\u4eba\u7684\u306b\u306f\u7701\u7565\u3057\u306a\u3044\u65b9\u304c\u597d\u307f\u3067\u3059\u3002<\/p>\n<li>\u62e1\u5f35\u5b50\u306e\u53d6\u5f97\u304c\u3067\u304d\u306a\u3044\u3002<\/li>\n<p>\u7b2c3\u7ae0-04\u300c\u30ea\u30cd\u30fc\u30e0\u3057\u306a\u304c\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308b\u300d\u306e\u30b3\u30fc\u30c9\u306b\u304a\u3044\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u5b50\u53d6\u5f97\u5206\u304c<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">kkcs = Mid(OpenFileName, InStrRev(OpenFileName, &quot;.&quot;), 5)<\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u62e1\u5f35\u5b50\u306e\u6587\u5b57\u6570\u3092\u6c7a\u3081\u6253\u3061\u3057\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u300cODCDATABASEFILE\u300d\u306e\u3088\u3046\u306a\u9577\u3044\u62e1\u5f35\u5b50\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u4e0d\u5177\u5408\u304c\u751f\u3058\u307e\u3059\u3002<\/p>\n<p>Mid\u95a2\u6570\u3092\u4f7f\u3046\u306e\u3067\u3042\u308c\u3070\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306blength\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u7701\u7565\u3057\u305f\u65b9\u304c\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">kkcs = Mid(OpenFileName, InStrRev(OpenFileName, &quot;.&quot;))<\/pre>\n<p>(\u500b\u4eba\u7684\u306b\u306fFileSystemObject\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eGetExtensionName\u30e1\u30bd\u30c3\u30c9\u306e\u65b9\u304c\u597d\u304d\u3067\u3059\u304c\u30fb\u30fb\u30fb)<\/p>\n<li>\u30d5\u30a1\u30a4\u30eb\u306e\u500b\u4eba\u60c5\u5831\u304c\u6b8b\u3063\u3066\u3044\u308b\u3002<\/li>\n<p>\u7b2c1\u7ae0\u3067\u30d6\u30c3\u30af\u306b\u6b8b\u3055\u308c\u3066\u3044\u308b\u500b\u4eba\u60c5\u5831\u3092\u524a\u9664\u3059\u308b\u624b\u9806\u304c\u8f09\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u30b5\u30f3\u30d7\u30eb\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u3001\u4f5c\u6210\u8005\u3084\u4fdd\u5b58\u8005\u306e\u6c0f\u540d\u304c\u6b8b\u3063\u305f\u307e\u307e\u306b\u306a\u3063\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u57f7\u7b46\u8005\u3092\u5224\u5225\u3059\u308b\u305f\u3081\u306b\u308f\u3056\u3068\u305d\u3046\u3057\u3066\u3044\u308b\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3053\u308c\u3089\u306e\u30d5\u30a1\u30a4\u30eb\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u524a\u9664\u3057\u3066\u304a\u3044\u3066\u3082\u826f\u304b\u3063\u305f\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002\n<\/ol>\n<p>\u4ee5\u4e0a\u3001\u5f8c\u534a\u306f\u3053\u307e\u304b\u30fc\u30fc\u3044\u30c4\u30c3\u30b3\u307f\u304c\u591a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u304c\u3001\u4e0a\u3067\u66f8\u3044\u305f\u901a\u308a\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u201c\u672c\u66f8\u306f\u5b9f\u52d9\u8005\u306e\u65b9\u306b\u306f\u304a\u85a6\u3081\u3067\u304d\u308b\u672c\u201d<\/span>\u3067\u3059\u3002<\/p>\n<p>\u5927\u578b\u306e\u66f8\u5e97\u3067\u306f\u53d6\u308a\u6271\u3063\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u6c17\u306b\u306a\u308b\u65b9\u306f\u662f\u975e\u624b\u306b\u53d6\u3063\u3066\u8aad\u3093\u3067\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><script type=\"text\/javascript\" src=\"http:\/\/wms-fe.amazon-adsystem.com\/20070822\/JP\/js\/link-enhancer-common.js?tag=kinuasa-22\">\n<\/script><br \/>\n<noscript><br \/>\n    <img decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/\/HLIC\/accba0b69f352b4c9440f05891b015c5.gif\" alt=\"\" \/><br \/>\n<\/noscript><\/p>\n","protected":false},"excerpt":{"rendered":"\u203b \u4e0b\u8a18\u30ec\u30d3\u30e5\u30fc\u306f\u3042\u304f\u307e\u3067\u3082\u500b\u4eba\u7684\u306a\u611f\u60f3\u3067\u3059\u3002 2015\u5e744\u670817\u65e5\u306b\u767a\u58f2\u3055\u308c\u305f\u300cEXCEL VBA \u696d\u52d9\u81ea\u52d5\u5316 [\u30d3\u30b8\u30c6\u30af] \u4ed5\u4e8b\u306e\u52b9\u7387\u3092\u5287\u7684\u306b\u4e0a\u3052\u308b\u30ce\u30a6\u30cf\u30a6 2013\/2010\/2007\u5bfe\u5fdc\u300d\u3092\u65e9\u901f\u8cfc\u5165\u3057\u3066\u304d\u307e\u3057\u305f\u3002 [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"\u65e9\u901f\u8aad\u3093\u3067\u307f\u307e\u3057\u305f\u3002 #VBA [\u300cEXCEL VBA \u696d\u52d9\u81ea\u52d5\u5316 \u4ed5\u4e8b\u306e\u52b9\u7387\u3092\u5287\u7684\u306b\u4e0a\u3052\u308b\u30ce\u30a6\u30cf\u30a6\u300d\u30ec\u30d3\u30e5\u30fc ]","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,48,120],"tags":[],"class_list":["post-5538","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-review"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1rk","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5538","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=5538"}],"version-history":[{"count":10,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5538\/revisions"}],"predecessor-version":[{"id":5548,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5538\/revisions\/5548"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7111"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}