{"id":4594,"date":"2014-07-08T17:01:25","date_gmt":"2014-07-08T08:01:25","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=4594"},"modified":"2017-06-15T17:21:40","modified_gmt":"2017-06-15T08:21:40","slug":"evernote%e3%81%ae%e3%83%8e%e3%83%bc%e3%83%88%e3%82%92xml%e5%bd%a2%e5%bc%8f%e3%81%a7%e4%bf%9d%e5%ad%98%e3%81%99%e3%82%8bvba%e3%83%9e%e3%82%af%e3%83%ad","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=4594","title":{"rendered":"Evernote\u306e\u30ce\u30fc\u30c8\u3092XML\u5f62\u5f0f\u3067\u4fdd\u5b58\u3059\u308bVBA\u30de\u30af\u30ed"},"content":{"rendered":"<p><a href=\"http:\/\/evernote.com\/intl\/jp\/download\/\" title=\"Evernote \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9 | Evernote\" target=\"_blank\">Evernote for Windows<\/a>\u306eType Library(Evernote API (enapi) 1.0 Type Library(C:\\Program Files\\Evernote\\Evernote\\enapi.dll))\u3092\u5229\u7528\u3057\u305f\u3001<a href=\"\/\/www.ka-net.org\/other\/ot07.html\" title=\"Evernote\u306e\u30ce\u30fc\u30c8\u3092\u5217\u6319\u3059\u308b(VBS)\" target=\"_blank\">Evernote\u306e\u30ce\u30fc\u30c8\u3092\u5217\u6319\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8<\/a>\u3092\u4f55\u5e74\u304b\u524d\u306b\u66f8\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u30ce\u30fc\u30c8\u3092XML\u5f62\u5f0f\u3067\u4fdd\u5b58(\u30a8\u30af\u30b9\u30dd\u30fc\u30c8)\u3059\u308b\u30de\u30af\u30ed\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  'Evernote\u306e\u30ce\u30fc\u30c8\u3092\u4fdd\u5b58\r\n  ExportEvernoteNote &quot;(\u30e6\u30fc\u30b6\u30fc\u540d)&quot;, _\r\n                     &quot;(\u30d1\u30b9\u30ef\u30fc\u30c9)&quot;, _\r\n                     &quot;(\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u540d)&quot;, _\r\n                     &quot;(\u4fdd\u5b58\u5148\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9)&quot;\r\n  'Evernote\u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u4fdd\u5b58\r\n  ExportEvernoteNoteBook &quot;(\u30e6\u30fc\u30b6\u30fc\u540d)&quot;, _\r\n                         &quot;(\u30d1\u30b9\u30ef\u30fc\u30c9)&quot;, _\r\n                         &quot;(\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u540d)&quot;, _\r\n                         &quot;(\u4fdd\u5b58\u5148\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9)&quot;\r\nEnd Sub\r\n\r\nPrivate Sub ExportEvernoteNote(ByVal Username As String, _\r\n                               ByVal Password As String, _\r\n                               ByVal NotebookName As String, _\r\n                               ByVal FolderPath As String)\r\n'\u6307\u5b9a\u3057\u305f\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u5185\u306e\u30ce\u30fc\u30c8\u3092XML\u5f62\u5f0f\u3067\u4fdd\u5b58\r\n' - Username:Evernote\u306e\u30e6\u30fc\u30b6\u30fc\u540d\r\n' - Password:Evernote\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\r\n' - NotebookName:Evernote\u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u540d\r\n' - FolderPath:\u4fdd\u5b58\u5148\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9\r\n  Dim en As Object 'enapiLib.Evernote\r\n  Dim nb As Object 'enapiLib.Notebook\r\n  Dim n As Object  'enapiLib.Note\r\n  Dim ff As Integer\r\n  \r\n  If Right(FolderPath, 1) &lt;&gt; ChrW(&amp;H5C) Then _\r\n     FolderPath = FolderPath &amp; ChrW(&amp;H5C)\r\n  If CreateObject(&quot;Scripting.FileSystemObject&quot;).FolderExists(FolderPath) = False Then\r\n    MsgBox &quot;\u4fdd\u5b58\u5148\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbCrLf &amp; _\r\n           &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbCritical + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  \r\n  On Error Resume Next\r\n  Set en = CreateObject(&quot;enapi.Evernote&quot;)\r\n  en.Login Username, Password, vbNullString\r\n  If Err.Number &lt;&gt; 0 Then\r\n    MsgBox &quot;Evernote for Windows\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u304b\u3001&quot; &amp; vbCrLf &amp; _\r\n           &quot;\u307e\u305f\u306f\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u5408\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;, vbCritical + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  On Error GoTo 0\r\n  \r\n  Set nb = GetNotebook(en, NotebookName)\r\n  If nb Is Nothing Then\r\n    MsgBox &quot;\u6307\u5b9a\u3057\u305f\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbCrLf &amp; _\r\n           &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbCritical + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  \r\n  'Note\u3054\u3068\u306b\u51fa\u529b\r\n  For Each n In nb.Notes\r\n    ff = FreeFile\r\n    Open FolderPath &amp; n.Title &amp; &quot;(&quot; &amp; n.ID &amp; &quot;).xml&quot; For Binary As #ff\r\n    Put #ff, , n.Export\r\n    Close #ff\r\n  Next\r\n  \r\n  MsgBox &quot;\u51e6\u7406\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002&quot;, vbInformation + vbSystemModal\r\nEnd Sub\r\n\r\nPrivate Sub ExportEvernoteNoteBook(ByVal Username As String, _\r\n                                   ByVal Password As String, _\r\n                                   ByVal NotebookName As String, _\r\n                                   ByVal FolderPath As String)\r\n'\u6307\u5b9a\u3057\u305f\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092XML\u5f62\u5f0f\u3067\u4fdd\u5b58\r\n' - Username:Evernote\u306e\u30e6\u30fc\u30b6\u30fc\u540d\r\n' - Password:Evernote\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\r\n' - NotebookName:Evernote\u306e\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u540d\r\n' - FolderPath:\u4fdd\u5b58\u5148\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9\r\n  Dim en As Object 'enapiLib.Evernote\r\n  Dim nb As Object 'enapiLib.Notebook\r\n  Dim ff As Integer\r\n  \r\n  If Right(FolderPath, 1) &lt;&gt; ChrW(&amp;H5C) Then _\r\n     FolderPath = FolderPath &amp; ChrW(&amp;H5C)\r\n  If CreateObject(&quot;Scripting.FileSystemObject&quot;).FolderExists(FolderPath) = False Then\r\n    MsgBox &quot;\u4fdd\u5b58\u5148\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbCrLf &amp; _\r\n           &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbCritical + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  \r\n  On Error Resume Next\r\n  Set en = CreateObject(&quot;enapi.Evernote&quot;)\r\n  en.Login Username, Password, vbNullString\r\n  If Err.Number &lt;&gt; 0 Then\r\n    MsgBox &quot;Evernote for Windows\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u304b\u3001&quot; &amp; vbCrLf &amp; _\r\n           &quot;\u307e\u305f\u306f\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u5408\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;, vbCritical + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  On Error GoTo 0\r\n  \r\n  Set nb = GetNotebook(en, NotebookName)\r\n  If nb Is Nothing Then\r\n    MsgBox &quot;\u6307\u5b9a\u3057\u305f\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbCrLf &amp; _\r\n           &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbCritical + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  \r\n  'Notebook\u5358\u4f4d\u3067\u51fa\u529b\r\n  ff = FreeFile\r\n  Open FolderPath &amp; nb.Name &amp; &quot;(&quot; &amp; nb.ID &amp; &quot;).xml&quot; For Binary As #ff\r\n  Put #ff, , nb.Export\r\n  Close #ff\r\n  \r\n  MsgBox &quot;\u51e6\u7406\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002&quot;, vbInformation + vbSystemModal\r\nEnd Sub\r\n\r\nPrivate Function GetNotebook(ByRef EvernoteApp As Object, _\r\n                             ByVal NotebookName As String) As Object\r\n'\u540d\u524d\u3092\u6307\u5b9a\u3057\u3066Notebook\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\r\n  Dim nb As Object 'enapiLib.Notebook\r\n  Dim ret As Object\r\n  \r\n  Set ret = Nothing '\u521d\u671f\u5316\r\n  For Each nb In EvernoteApp.Notebooks\r\n    If nb.Name = NotebookName Then\r\n      Set ret = nb\r\n      Exit For\r\n    End If\r\n  Next\r\n  Set GetNotebook = ret\r\nEnd Function\r\n<\/pre>\n<p><span style=\"color: #ff0000; font-weight: bold;\">ExportEvernoteNote<\/span>\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306f\u30ce\u30fc\u30c8\u5358\u4f4d\u3001<span style=\"color: #ff0000; font-weight: bold;\">ExportEvernoteNoteBook<\/span>\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306f\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u5358\u4f4d\u3067\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<p>VBA\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u30ce\u30fc\u30c8\u306e\u4fdd\u5b58\u304c\u3067\u304d\u308b\u306e\u306f\u3068\u3066\u3082\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001\u3042\u304f\u307e\u3067\u3082Windows\u7248\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u306e\u3067\u3001<span style=\"color: #ff0000; font-weight: bold;\">Evernote for Windows\u304c\u5fc5\u8981<\/span>\u3067\u3042\u308b\u70b9\u3068\u3001PC\u306b\u4fdd\u5b58\u3055\u308c\u305f\u30c7\u30fc\u30bf\u306e\u307f\u304c\u5bfe\u8c61\u3068\u306a\u308b\u306e\u3067\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u540c\u671f\u3055\u308c\u3066\u3044\u306a\u3044\u30c7\u30fc\u30bf\u306f\u4fdd\u5b58\u3067\u304d\u306a\u3044<\/span>\u70b9\u306f\u8981\u6ce8\u610f\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Evernote for Windows\u306eType Library(Evernote API (enapi) 1.0 Type Library(C:\\Program Files\\Evernote\\Evernote\\ena [&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,49,152],"tags":[],"class_list":["post-4594","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-word-office","category-evernote"],"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-1c6","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4594","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=4594"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4594\/revisions"}],"predecessor-version":[{"id":4595,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4594\/revisions\/4595"}],"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=4594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}