{"id":3065,"date":"2015-08-13T21:16:07","date_gmt":"2015-08-13T12:16:07","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=3065"},"modified":"2015-08-13T21:16:07","modified_gmt":"2015-08-13T12:16:07","slug":"classconstructordestructor","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/classconstructordestructor\/","title":{"rendered":"VBA\u3067\u3001\u30af\u30e9\u30b9\u3092\u4f5c\u6210\uff08\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u30fb\u30c7\u30b9\u30c8\u30e9\u30af\u30bf\uff09"},"content":{"rendered":"<h2>VBA \u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3068\u30c7\u30b9\u30c8\u30e9\u30af\u30bf<\/h2>\n<div class=\"m30-l\">\n<br \/>\n<h3>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf<\/h3>\n<p><strong>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf<\/strong>\u306f\u3001\u30af\u30e9\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c <strong>New<\/strong> \u306b\u3088\u3063\u3066\u4f5c\u6210\u3055\u308c\u308b\u6642\u306b<span class=\"red\">\u81ea\u52d5\u7684\u306b\u547c\u3073\u51fa\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9<\/span>\u3067\u3059\u3002\u305f\u3060\u3057\u3001<span class=\"red\">VBA \u306e\u5834\u5408\u306f\u3001\u5f15\u6570\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044<\/span>\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<div class=\"kkbox\"><strong>\u3010\u69cb\u6587\u3011<\/strong><\/p>\n<p>    <strong>Private<\/strong> <strong>Sub<\/strong> <strong>Class_Initialize<\/strong> ()<\/p>\n<p>    \u3000\u3000[ <em>statements<\/em> ]<\/p>\n<p>    <strong>End<\/strong> <strong>Sub<\/strong><\/p><\/div>\n<br \/>\n<h4>\u9805\u76ee\u306e\u8aac\u660e<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>statements&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5b9f\u884c\u3055\u308c\u308b\u4e00\u9023\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<h3>\u30c7\u30b9\u30c8\u30e9\u30af\u30bf<\/h3>\n<p><strong>\u30c7\u30b9\u30c8\u30e9\u30af\u30bf<\/strong>\u306f\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u7834\u68c4\u3059\u308b\u969b\u3001<span class=\"red\">\u81ea\u52d5\u7684\u306b\u547c\u3073\u51fa\u3055\u308c\u308b\u30e1\u30bd\u30c3\u30c9<\/span>\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<div class=\"kkbox\"><strong>\u3010\u69cb\u6587\u3011<\/strong><\/p>\n<p>    <strong>Private<\/strong> <strong>Sub<\/strong> <strong>Class_Terminate<\/strong> ()<\/p>\n<p>    \u3000\u3000[ <em>statements<\/em> ]<\/p>\n<p>    <strong>End<\/strong> <strong>Sub<\/strong><\/p><\/div>\n<br \/>\n<h4>\u9805\u76ee\u306e\u8aac\u660e<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>statements&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5b9f\u884c\u3055\u308c\u308b\u4e00\u9023\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<\/ul><\/div>\n<\/div>\n<br \/><br \/>\n<h2>\u30af\u30e9\u30b9\uff08\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u30fb\u30c7\u30b9\u30c8\u30e9\u30af\u30bf\uff09 \u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"\u30af\u30e9\u30b9\u30e2\u30b8\u30e5\u30fc\u30eb\uff08\u30af\u30e9\u30b9\u540d\uff1aClass2 \uff09\" data-url=\"http:\/\/example.co.jp\" >\r\n\r\n\u3000\r\n'\u30af\u30e9\u30b9\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3000\r\nPrivate myStr As String\r\n\r\n'\u30af\u30e9\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\r\nPublic Sub myFunc()\r\n\r\n    myStr = myStr & \"myFunc!!\" & Chr(13)\r\n\r\nEnd Sub\r\n\r\n'\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\r\nPrivate Sub Class_Initialize()\r\n\r\n    myStr = myStr & \"Class Start!!\" & Chr(13)\r\n\r\nEnd Sub\r\n\r\n'\u30c7\u30b9\u30c8\u30e9\u30af\u30bf\r\nPrivate Sub Class_Terminate()\r\n\r\n    myStr = myStr & \"Class End!!\" & Chr(13)\r\n    MsgBox myStr\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample01_Class2()\r\n\r\n    '\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4f5c\u6210\r\n    Dim cc As New Class2\r\n    \r\n    cc.myFunc\r\n    \r\n    '\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u7834\u68c4\r\n    Set cc = Nothing\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/08\/vba_class2_01.jpg?ssl=1\" rel=\"lightbox[3065]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/08\/vba_class2_01.jpg?resize=168%2C185&#038;ssl=1\" alt=\"VBA \u30af\u30e9\u30b9 \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u30fb\u30c7\u30b9\u30c8\u30e9\u30af\u30bf \u4f8b 01\" width=\"168\" height=\"185\" class=\"alignnone size-full wp-image-3069\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/>\n","protected":false},"excerpt":{"rendered":"<p>VBA \u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3068\u30c7\u30b9\u30c8\u30e9\u30af\u30bf \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f\u3001\u30af\u30e9\u30b9 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":3069,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[500],"tags":[501,38,184,502,503],"jetpack_featured_media_url":"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/08\/vba_class2_01.jpg?fit=168%2C185&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-Nr","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3065"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=3065"}],"version-history":[{"count":8,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3065\/revisions"}],"predecessor-version":[{"id":3096,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/3065\/revisions\/3096"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/3069"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=3065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=3065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=3065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}