{"id":7240,"date":"2016-08-25T13:46:30","date_gmt":"2016-08-25T04:46:30","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=7240"},"modified":"2016-08-25T13:46:30","modified_gmt":"2016-08-25T04:46:30","slug":"office%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%8b%e3%82%89%e4%bd%9c%e6%88%90%e8%80%85%e3%81%aa%e3%81%a9%e3%81%ae%e3%83%97%e3%83%ad%e3%83%91%e3%83%86%e3%82%a3%e3%82%92%e5%8f%96%e5%be%97%e3%81%99","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=7240","title":{"rendered":"Office\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u4f5c\u6210\u8005\u306a\u3069\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53d6\u5f97\u3059\u308bVBScript"},"content":{"rendered":"<p>\u4e0b\u8a18\u8a18\u4e8b\u3067\u3082\u66f8\u3044\u3066\u3044\u307e\u3059\u304c\u3001xlsx\u3084docx\u3068\u3044\u3063\u305f\u3001OOXML\u5f62\u5f0f\u306eOffice\u30d5\u30a1\u30a4\u30eb\u3092ZIP\u89e3\u51cd\u3059\u308b\u3068\u3001\u4e2d\u306b\u3042\u308bXML\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u69d8\u3005\u306a\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=6289\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel-120x120.png' alt='\u300cExcel VBA\u306e\u795e\u69d8 \u30dc\u30af\u306e\u4eba\u751f\u3092\u5909\u3048\u3066\u304f\u308c\u305f\u4eba\u300d(\u5927\u6751\u3042\u3064\u3057\u8457)\u30ec\u30d3\u30e5\u30fc' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2015.10.07<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=6289\">\u300cExcel VBA\u306e\u795e\u69d8 \u30dc\u30af\u306e\u4eba\u751f\u3092\u5909\u3048\u3066\u304f\u308c\u305f\u4eba\u300d(\u5927\u6751\u3042\u3064\u3057\u8457)\u30ec\u30d3\u30e5\u30fc <\/a><\/div><div class=\"cardlink_excerpt\">\u203b \u4e0b\u8a18\u30ec\u30d3\u30e5\u30fc\u306f\u3042\u304f\u307e\u3067\u3082\u500b\u4eba\u7684\u306a\u611f\u60f3\u3067\u3059\u3002\r\n\r\n\r\n2015\u5e749\u670829\u65e5\u767a\u58f2\u306e\u300cExcel VBA\u306e\u795e\u69d8 \u30dc\u30af\u306e\u4eba\u751f\u3092\u5909\u3048\u3066\u304f\u308c\u305f\u4eba\u300d(\u79c0\u548c\u30b7\u30b9\u30c6\u30e0\u51fa\u7248)\u3092\u3055\u3063\u305d\u304f\u8cfc\u5165\u3057\u3066\u304d\u307e\u3057\u305f\u3002\r\n\r\n\r\n\r\n\r\n\r\n\u4f5c\u8005\u306fOffice(VBA)\u754c\u9688\u3067\u306f\u77e5\u3089\u306a\u3044\u4eba\u306f...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<p>\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u5c11\u306a\u3051\u308c\u3070\u7279\u306b\u554f\u984c\u306f\u7121\u3044\u306e\u3067\u3059\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u591a\u3044\u3068\u304d\u3001\u3044\u3061\u3044\u3061\u89e3\u51cd\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u63a2\u3057\u3066\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u3067\u958b\u3044\u3066\u2026\u3068\u3044\u3046\u306e\u306f\u5c11\u3005\u9762\u5012\u81ed\u304f\u611f\u3058\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u3060\u3051\u3067\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nDim Args\r\n\r\nSet Args = WScript.Arguments\r\nIf Args.Count &lt; 1 Then\r\n  MsgBox &quot;Office\u30d5\u30a1\u30a4\u30eb\u3092\u5f53\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;, vbExclamation + vbSystemModal\r\n  WScript.Quit\r\nEnd If\r\nGetOpenXMLInfo Args(0)\r\n\r\nPrivate Sub GetOpenXMLInfo(ByVal TargetFilePath)\r\n  Dim TmpFolderName\r\n  Dim TmpFolderPath\r\n  Dim TmpFileName\r\n  Dim TmpFilePath\r\n  Dim DpFolderPath\r\n  Dim AppFilePath\r\n  Dim CoreFilePath\r\n  Dim AppVersion\r\n  Dim dc_creator\r\n  Dim cp_lastModifiedBy\r\n  Dim dcterms_created\r\n  Dim dcterms_modified\r\n  Dim d1, d2\r\n  Const dp = &quot;docProps&quot;\r\n  Const app = &quot;app.xml&quot;\r\n  Const core = &quot;core.xml&quot;\r\n    \r\n  '\u4f5c\u696d\u7528\u30d5\u30a9\u30eb\u30c0\u4f5c\u6210\u30fb\u4f5c\u696d\u7528\u30d5\u30a1\u30a4\u30eb(zip)\u30b3\u30d4\u30fc\r\n  TmpFolderName = Replace(Now(), &quot;\/&quot;, &quot;&quot;)\r\n  TmpFolderName = Replace(TmpFolderName, &quot;:&quot;, &quot;&quot;)\r\n  TmpFolderName = Replace(TmpFolderName, &quot; &quot;, &quot;&quot;)\r\n  TmpFolderName = &quot;tmp_&quot; &amp; TmpFolderName\r\n  With CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n    TmpFolderPath = AddPathSeparator(.GetFile(TargetFilePath).ParentFolder.Path) &amp; _\r\n                    TmpFolderName\r\n    If .FolderExists(TmpFolderPath) = True Then\r\n      MsgBox &quot;\u4f5c\u696d\u7528\u30d5\u30a9\u30eb\u30c0\u304c\u3059\u3067\u306b\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002&quot; &amp; vbNewLine &amp; _\r\n             &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbExclamation + vbSystemModal\r\n      Exit Sub\r\n    End If\r\n    .CreateFolder TmpFolderPath\r\n    TmpFileName = .GetBaseName(.GetFile(TargetFilePath)) &amp; &quot;.zip&quot;\r\n    TmpFilePath = AddPathSeparator(TmpFolderPath) &amp; TmpFileName\r\n    .CopyFile TargetFilePath, TmpFilePath, True\r\n  End With\r\n  \r\n  'zip\u30d5\u30a1\u30a4\u30eb\u304b\u3089&#x5B;docProps]\u30d5\u30a9\u30eb\u30c0\u3092\u30b3\u30d4\u30fc\r\n  With CreateObject(&quot;Shell.Application&quot;)\r\n    .Namespace(TmpFolderPath).CopyHere .Namespace(TmpFilePath).Items.Item(dp)\r\n  End With\r\n  \r\n  'xml\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u53d6\u5f97\r\n  With CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n    DpFolderPath = AddPathSeparator(TmpFolderPath) &amp; dp\r\n    If .FolderExists(DpFolderPath) = False Then\r\n      MsgBox &quot;&#x5B;docProps]\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbNewLine &amp; _\r\n             &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbExclamation + vbSystemModal\r\n      DelFolder TmpFolderPath\r\n      Exit Sub\r\n    End If\r\n    AppFilePath = AddPathSeparator(DpFolderPath) &amp; app\r\n    CoreFilePath = AddPathSeparator(DpFolderPath) &amp; core\r\n    If (.FileExists(AppFilePath) = False) Or _\r\n       (.FileExists(CoreFilePath) = False) Then\r\n      MsgBox &quot;XML\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbNewLine &amp; _\r\n             &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbExclamation + vbSystemModal\r\n      DelFolder TmpFolderPath\r\n      Exit Sub\r\n    End If\r\n  End With\r\n  \r\n  'xml\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u5024\u3092\u53d6\u5f97\r\n  With CreateObject(&quot;MSXML2.DOMDocument&quot;)\r\n    .async = False\r\n    If .Load(AppFilePath) = False Then\r\n      MsgBox app &amp; &quot;\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot; &amp; vbNewLine &amp; _\r\n             &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbExclamation + vbSystemModal\r\n      DelFolder TmpFolderPath\r\n      Exit Sub\r\n    End If\r\n    On Error Resume Next\r\n    AppVersion = .SelectSingleNode(&quot;\/Properties\/AppVersion&quot;).Text\r\n    On Error GoTo 0\r\n    If .Load(CoreFilePath) = False Then\r\n      MsgBox core &amp; &quot;\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002&quot; &amp; vbNewLine &amp; _\r\n             &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbExclamation + vbSystemModal\r\n      DelFolder TmpFolderPath\r\n      Exit Sub\r\n    End If\r\n    On Error Resume Next\r\n    dc_creator = .SelectSingleNode(&quot;\/cp:coreProperties\/dc:creator&quot;).Text\r\n    cp_lastModifiedBy = .SelectSingleNode(&quot;\/cp:coreProperties\/cp:lastModifiedBy&quot;).Text\r\n    dcterms_created = .SelectSingleNode(&quot;\/cp:coreProperties\/dcterms:created&quot;).Text\r\n    d1 = Replace(dcterms_created, &quot;T&quot;, &quot; &quot;)\r\n    d1 = Replace(d1, &quot;Z&quot;, &quot;&quot;)\r\n    dcterms_modified = .SelectSingleNode(&quot;\/cp:coreProperties\/dcterms:modified&quot;).Text\r\n    d2 = Replace(dcterms_modified, &quot;T&quot;, &quot; &quot;)\r\n    d2 = Replace(d2, &quot;Z&quot;, &quot;&quot;)\r\n    On Error GoTo 0\r\n  End With\r\n  DelFolder TmpFolderPath\r\n  \r\n  '\u7d50\u679c\u8868\u793a\r\n  MsgBox &quot;File:&quot; &amp; TargetFilePath &amp; vbNewLine &amp; _\r\n         &quot;AppVersion:&quot; &amp; AppVersion &amp; vbNewLine &amp; _\r\n         &quot;dc:creator:&quot; &amp; dc_creator &amp; vbNewLine &amp; _\r\n         &quot;cp:lastModifiedBy:&quot; &amp; cp_lastModifiedBy &amp; vbNewLine &amp; _\r\n         &quot;dcterms:created:&quot; &amp; dcterms_created &amp; &quot;(&quot; &amp; DateAdd(&quot;h&quot;, 9, CDate(d1)) &amp; &quot;)&quot; &amp; vbNewLine &amp; _\r\n         &quot;dcterms:modified:&quot; &amp; dcterms_modified &amp; &quot;(&quot; &amp; DateAdd(&quot;h&quot;, 9, CDate(d2)) &amp; &quot;)&quot;, vbInformation + vbSystemModal\r\nEnd Sub\r\n\r\nPrivate Sub DelFolder(ByVal TargetFolderPath)\r\n  With CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n    .DeleteFolder TargetFolderPath, True\r\n  End With\r\nEnd Sub\r\n\r\nPrivate Function AddPathSeparator(ByVal s)\r\n  If Right(s, 1) &lt;&gt; ChrW(92) Then s = s &amp; ChrW(92)\r\n  AddPathSeparator = s\r\nEnd Function<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092vbs\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4fdd\u5b58\u3057\u305f\u5f8c\u3001Office\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3084\u4f5c\u6210\u8005\u3001\u66f4\u65b0\u65e5\u6642\u3068\u3044\u3063\u305f\u60c5\u5831\u304c\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u3067\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetOpenXMLInfo_01.jpg\" alt=\"GetOpenXMLInfo_01\" width=\"456\" height=\"288\" class=\"alignnone size-full wp-image-7241\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetOpenXMLInfo_01.jpg 456w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetOpenXMLInfo_01-300x189.jpg 300w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetOpenXMLInfo_02.jpg\" alt=\"GetOpenXMLInfo_02\" width=\"438\" height=\"230\" class=\"alignnone size-full wp-image-7242\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetOpenXMLInfo_02.jpg 438w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GetOpenXMLInfo_02-300x158.jpg 300w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u304c\u5206\u304b\u3063\u305f\u304b\u3089\u3068\u3044\u3063\u3066\u3069\u3046\u3068\u3044\u3046\u3053\u3068\u3082\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u5fdc\u7528\u3059\u308b\u3068\u3001Office\u30d5\u30a1\u30a4\u30eb\u306b\u542b\u307e\u308c\u308b\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u629c\u304d\u51fa\u3057\u305f\u308a\u3001\u306a\u3093\u3066\u3053\u3068\u3082\u3067\u304d\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4e0b\u8a18\u8a18\u4e8b\u3067\u3082\u66f8\u3044\u3066\u3044\u307e\u3059\u304c\u3001xlsx\u3084docx\u3068\u3044\u3063\u305f\u3001OOXML\u5f62\u5f0f\u306eOffice\u30d5\u30a1\u30a4\u30eb\u3092ZIP\u89e3\u51cd\u3059\u308b\u3068\u3001\u4e2d\u306b\u3042\u308bXML\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u69d8\u3005\u306a\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u30d5\u30a1\u30a4\u30eb\u6570\u304c\u5c11\u306a\u3051\u308c\u3070\u7279\u306b\u554f\u984c\u306f\u7121\u3044\u306e\u3067\u3059\u304c [&hellip;]","protected":false},"author":1,"featured_media":7132,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[Office\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u4f5c\u6210\u8005\u306a\u3069\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53d6\u5f97\u3059\u308bVBScript]","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,49,58,6],"tags":[],"class_list":["post-7240","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-word-office","category-powerpoint","category-vbs"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-VBScript.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1SM","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7240","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=7240"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7240\/revisions"}],"predecessor-version":[{"id":7243,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7240\/revisions\/7243"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7132"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}