{"id":4668,"date":"2014-07-31T10:53:18","date_gmt":"2014-07-31T01:53:18","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=4668"},"modified":"2014-09-19T09:24:34","modified_gmt":"2014-09-19T00:24:34","slug":"%e9%81%b8%e6%8a%9e%e7%af%84%e5%9b%b2%e3%82%92onenote%e3%81%ab%e9%80%81%e3%82%8bvba%e3%83%9e%e3%82%af%e3%83%ad","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=4668","title":{"rendered":"\u9078\u629e\u7bc4\u56f2\u3092OneNote\u306b\u9001\u308bVBA\u30de\u30af\u30ed"},"content":{"rendered":"<p>OneNote \u30d7\u30ea\u30f3\u30bf\u30fc\u30c9\u30e9\u30a4\u30d0\u30fc([OneNote 20XX \u306b\u9001\u308b]\u30d7\u30ea\u30f3\u30bf\u30fc)\u3092\u4f7f\u3063\u3066\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u5370\u5237\u3059\u308b\u3068\u3001\u5370\u5237\u3057\u305f\u60c5\u5831\u304c\u305d\u306e\u307e\u307eOneNote\u306b\u9001\u3089\u308c\u307e\u3059\u3002<br \/>\n\u3053\u306e\u6a5f\u80fd\u3092\u4f7f\u3048\u3070\u7c21\u5358\u306b\u9078\u629e\u7bc4\u56f2\u3092OneNote\u306b\u53d6\u308a\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u65e9\u901f\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub SendToOneNote()\r\n'PrintOut\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066OneNote\u306b\u9078\u629e\u7bc4\u56f2\u3092\u9001\u308b\r\n  Dim prnON As String\r\n  Dim tmp As String\r\n  \r\n  prnON = GetOneNotePrinterName\r\n  If Len(Trim(prnON)) &lt; 1 Then Exit Sub\r\n  tmp = Application.ActivePrinter\r\n  On Error Resume Next\r\n  Selection.PrintOut ActivePrinter:=prnON\r\n  On Error GoTo 0\r\n  Application.ActivePrinter = tmp\r\nEnd Sub\r\n\r\nPrivate Function GetOneNotePrinterName() As String\r\n'OneNote\u30d7\u30ea\u30f3\u30bf\u30fc\u540d\u53d6\u5f97\r\n  Dim ret As String\r\n  Dim colItems As Object\r\n  Dim itm As Object\r\n  \r\n  ret = &quot;&quot; '\u521d\u671f\u5316\r\n  On Error Resume Next\r\n  Set colItems = CreateObject(&quot;WbemScripting.SWbemLocator&quot;).ConnectServer.ExecQuery(&quot;Select * from Win32_Printer&quot;)\r\n  For Each itm In colItems\r\n    If InStr(LCase(itm.DriverName), &quot;onenote&quot;) Then\r\n      ret = itm.Name\r\n      Exit For\r\n    End If\r\n  Next\r\n  On Error GoTo 0\r\n  GetOneNotePrinterName = ret\r\nEnd Function<\/pre>\n<p>\u4e0a\u8a18\u306e\u901a\u308a\u3001\u5358\u306b\u30d7\u30ea\u30f3\u30bf\u30fc\u3068\u3057\u3066OneNote \u30d7\u30ea\u30f3\u30bf\u30fc\u30c9\u30e9\u30a4\u30d0\u30fc\u3092\u6307\u5b9a\u3057\u3066\u9078\u629e\u7bc4\u56f2\u3092\u5370\u5237\u3057\u3066\u3044\u308b\u3060\u3051\u306e\u30de\u30af\u30ed\u3067\u3059\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u308c\u3067\u7c21\u5358\u306bExcel\u30c7\u30fc\u30bf\u3092OneNote\u306b\u9001\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"OneNote \u30d7\u30ea\u30f3\u30bf\u30fc\u30c9\u30e9\u30a4\u30d0\u30fc([OneNote 20XX \u306b\u9001\u308b]\u30d7\u30ea\u30f3\u30bf\u30fc)\u3092\u4f7f\u3063\u3066\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u5370\u5237\u3059\u308b\u3068\u3001\u5370\u5237\u3057\u305f\u60c5\u5831\u304c\u305d\u306e\u307e\u307eOneNote\u306b\u9001\u3089\u308c\u307e\u3059\u3002 \u3053\u306e\u6a5f\u80fd\u3092\u4f7f\u3048\u3070\u7c21\u5358\u306b\u9078\u629e\u7bc4\u56f2\u3092OneNote\u306b [&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":"","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,48,55],"tags":[],"class_list":["post-4668","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-onenote"],"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-1di","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4668","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=4668"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4668\/revisions"}],"predecessor-version":[{"id":4669,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4668\/revisions\/4669"}],"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=4668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}