{"id":2476,"date":"2023-02-01T05:48:12","date_gmt":"2023-01-31T20:48:12","guid":{"rendered":"http:\/\/oreoreki.gotdns.ch\/?p=2476"},"modified":"2023-02-01T23:45:08","modified_gmt":"2023-02-01T14:45:08","slug":"post-2476","status":"publish","type":"post","link":"http:\/\/oreoreki.gotdns.ch\/?p=2476","title":{"rendered":"Excel VBA\u3067\u65b0\u5e79\u7dda\u30fb\u7a7a\u6e2f\u306e\u97f3\u3092\u9cf4\u3089\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p><iframe loading=\"lazy\" title=\"Excel VBA\u3067\u65b0\u5e79\u7dda\u30fb\u7a7a\u6e2f\u306e\u97f3\u3092\u9cf4\u3089\u3057\u3066\u307f\u305f\" width=\"750\" height=\"422\" src=\"https:\/\/www.youtube.com\/embed\/nZamP2HxtZU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p><span>Excel VBA\u3067\u65b0\u5e79\u7dda\u30fb\u7a7a\u6e2f\u306e\u97f3\u3092\u9cf4\u3089\u3057\u3066\u307f\u305f<\/span><br \/>\n<span class=\"bold-red\">\u3053\u306e\u52d5\u753b\u306e\u30de\u30af\u30ed\u306fWindows11\/Office2016\u3067\u4f5c\u6210\u3057\u3066\u307e\u3059\u3002<br \/>\n<\/span><\/p>\n<h2><\/h2>\n<pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>'MIDI API\r\nPrivate Declare PtrSafe Function midiOutGetNumDevs Lib \"winmm\" () As Integer\r\nPrivate Declare PtrSafe Function midiOutOpen Lib \"winmm.dll\" (lphMidiOut As LongPtr, ByVal uDeviceID As Long, ByVal dwCallback As LongPtr, ByVal dwInstance As LongPtr, ByVal dwflags As Long) As Long\r\nPrivate Declare PtrSafe Function midiOutShortMsg Lib \"winmm.dll\" (ByVal hMidiOut As LongPtr, ByVal dwMsg As Long) As Long\r\nPrivate Declare PtrSafe Function midiOutClose Lib \"winmm.dll\" (ByVal hMidiOut As LongPtr) As Long\r\nDim Handle As LongPtr\r\n'Sleep API\r\nPrivate Declare PtrSafe Sub Sleep Lib \"kernel32\" (ByVal dwMilliseconds As LongPtr)\r\nPrivate Declare PtrSafe Function MessageBoxTimeoutA Lib \"User32.dll\" (ByVal hWnd As LongPtr, ByVal lpText As String, ByVal lpCaption As String, ByVal uType As VbMsgBoxStyle, ByVal wLanguageID As Long, ByVal dwMilliseconds As Long) As Long\r\n\r\n\r\nSub test10()\r\n    '\u30c7\u30fc\u30bf\u30fc\u3000XXYY,ZZ,ZZ,,ZZ,,,ZZ,\u30fb\u30fb\u30fb\r\n    '\u6700\u521d\u306e\u9805\u76eeXXYY\u3000XX:\u697d\u5668\u306e\u7a2e\u985e00-7F   YY:1\u8981\u7d20\u3042\u305f\u308a\u306e\u5f85\u3061\u6642\u9593\uff0816\u9032\uff09\r\n    '2\u4ee5\u964d\u306e\u9805\u76eeZZ\u3000 ZZ:\u771f\u3093\u4e2d\u306e\u30c930,\u30c9#32,\u30ec32,  \u9ad8\u3044\u30c9:3C     \u548c\u97f3\u306e\u5834\u5408:\u3067\u533a\u5207\u308b\u3000\u30c9\u30df\u30bd\u300030:34:37\r\n    MessageBoxTimeoutA 0, \"\u6771\u6d77\u9053\u65b0\u5e79\u7dda\", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg(\"0B10,35:45,,,,,,,,3C,,,,,,,,41,,,,,,,,,3C:48,,,,,,,,45,,,,,,,,,41:46,,,,,,,,45:48,,,,,,,,,,,,,,,,,,34:46,,,,,,,,,3A,,,,,,,,3E:45,,,,,,,,,41,,,,,,,,39:40,,,,,,,,3D,,,,,,,,43,,,,,,,,,41,,,,,,,,3E,,,,,,,,,45,,,,,,,,4A,,,,,,,,45,,,,,,,,,41:4C,,,,,,,,41:4C,,,,,,,,,43:4A,,,,,,,,,45,,,,,,,,3C:46,,,,,,,,,43,,,,,,,,45:48,,,,,,,,,43,,,,,,,,,34:48,,,,,,,,3C:45,,,,,,,,40:43,,,,,,,,,45,,,,,,,,35:41,,3C,45,48,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\")\r\n\r\n    MessageBoxTimeoutA 0, \"\u5317\u9678\u65b0\u5e79\u7dda\", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg(\"0010,31:49,,,,,,,,44,,,,,,,38,41,,,,,44,,,,48,,,,2C:4B,,,,,,,,48,,,,,,,38:42,,,,,,,4B,,,,,,,,31:4D,,,,,,,,49,,,,,,,3B:42,,,,,,,,,,,4D,,,,,4A,,2A,4E,,,,,,,,49,,,,,,,,,36:46,,,,,,,,,,,,,42,,,,,,,,,,31,,,49,,35,38,,3D,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\")\r\n\r\n    MessageBoxTimeoutA 0, \"\u6771\u5317\u65b0\u5e79\u7dda\", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg(\"0010,37:47,,,,,,,,,,,3E,,,,,45,,,,,43,,,,,47,,,,,48,39,,,,,,,,,,3E,,,,47,,,,,,45,,,,,48,,,,,,3B:4A,,,,48,,,,,,3E:47,,,,,4A,,,,,4F,,,,,4E,,,,,3C:4C,,,,,4A,,,,,,48,,,,47,,,,,,30:43:45,,,,,,,,,,,32:45,,,47,,,,47,,,,36,47,,45,,,47,,45,,,47,3C,,45,,,,43,,45,,,37:43,,,,,,3B,,,,,,3E,,,,,47,,,,,,,43,,,,,,4A,,,,,,,,,4F,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\")\r\n\r\n    MessageBoxTimeoutA 0, \"\u7fbd\u7530\u7a7a\u6e2f\", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg(\"04FF,45,,42,,45,,4A,,,,,,,,,,,,,,,,\")\r\n\r\n    MessageBoxTimeoutA 0, \"\u6210\u7530\u7a7a\u6e2f\", \"\u97f3\", 0, 65536, 1000\r\n    Call PlayMsg(\"0B40,43,45,48,4A,4C,4F,54,43:56,,,,,,,,,,,,,,,,,,,,,,,,\")\r\n\r\nEnd Sub\r\n\r\n\r\nPublic Function PlayMsg(msg_dat)\r\n    Dim Msg As Long\r\n    \r\n    'MIDI\u51fa\u529b\u30c7\u30d0\u30a4\u30b9\u53d6\u5f97\r\n    Dim Ret As Long\r\n    Ret = midiOutGetNumDevs\r\n\r\n    'MIDI\u30c7\u30d0\u30a4\u30b9\u3092\u958b\u304f\r\n    If Ret = 0 Then\r\n        Debug.Print \"MIDI\u97f3\u6e90\u304c\u7121\u3044\u305f\u3081\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3002\"\r\n        Exit Function\r\n    End If\r\n    Ret = midiOutOpen(Handle, -1, 0, 0, 0)\r\n    arr_dat = Split(msg_dat, \",\")\r\n    Call midiOutShortMsg(Handle, \"&H\" & Mid(arr_dat(0), 1, 2) & \"C0\")     '\r\n    For i = 1 To UBound(arr_dat)\r\n        If arr_dat(i) <> \"\" Then\r\n            arr_dat2 = Split(arr_dat(i), \":\")\r\n            For j = 0 To UBound(arr_dat2)\r\n                Msg = Val(\"&H7F\" & arr_dat2(j) & \"90\")\r\n                Call midiOutShortMsg(Handle, Msg)\r\n            Next\r\n        End If\r\n        Sleep (\"&H\" & Mid(arr_dat(0), 3, 2))\r\n        DoEvents\r\n    Next\r\n    'MIDI\u30c7\u30d0\u30a4\u30b9\u3092\u9589\u3058\u308b\r\n    Ret = midiOutClose(Handle)\r\nEnd Function\r\n\r\n\r\n\r\n<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Excel VBA\u3067\u65b0\u5e79\u7dda\u30fb\u7a7a\u6e2f\u306e\u97f3\u3092\u9cf4\u3089\u3057\u3066\u307f\u305f \u3053\u306e\u52d5\u753b\u306e\u30de\u30af\u30ed\u306fWindows11\/Offic [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2478,"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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[34],"tags":[],"class_list":["post-2476","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vba"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"http:\/\/oreoreki.gotdns.ch\/wp-content\/uploads\/sites\/2\/2023\/02\/excel-vba.jpg","jetpack_shortlink":"https:\/\/wp.me\/p9WqRX-DW","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2476"}],"version-history":[{"count":5,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2476\/revisions"}],"predecessor-version":[{"id":2485,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/posts\/2476\/revisions\/2485"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=\/wp\/v2\/media\/2478"}],"wp:attachment":[{"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2476"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/oreoreki.gotdns.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}