{"id":765,"date":"2024-06-18T08:47:17","date_gmt":"2024-06-18T00:47:17","guid":{"rendered":"http:\/\/www.wyrcad.com\/?p=765"},"modified":"2024-06-18T08:54:46","modified_gmt":"2024-06-18T00:54:46","slug":"microsoft-excel-%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/www.wyrcad.com\/?p=765","title":{"rendered":"Microsoft Excel \u57fa\u672c\u64cd\u4f5c"},"content":{"rendered":"\n<p>&#8216;\u7ed1\u5b9a Microsoft Excel<br>Dim oExcel As Object &#8216;Microsoft Excel Application \u672c\u8eab<br>Call BindExcel(True)<br>Dim oBook As Object &#8216;Microsoft Excel \u591a\u5de5\u4f5c\u8584\u4e4b\u4e00<br>Dim oSheet As Object &#8216;\u5de5\u4f5c\u8584\u7684\u5de5\u4f5c\u8868\u4e4b\u4e00<\/p>\n\n\n\n<p>\u2018\u6253\u5f00\u5e76\u7ed1\u5b9a\u6587\u4ef6 D:\/Test.xls<br>Set oBook = oExcel.Application.WorkBooks.Open(\u201cD:\/Test.xls\u201d)<\/p>\n\n\n\n<p>\u2018\u7ed1\u5b9a\u5df2\u7ecf\u6253\u5f00\u6587\u4ef6 Demo.xls<br>Set oBook = oExcel.WorkBooks.Item(\u201cDemo.xls\u201d)<\/p>\n\n\n\n<p>\u2018\u65b0\u5efa\u6587\u4ef6\u5e76\u7ed1\u5b9a<br>Set oBook = oExcel.WorkBooks.Add<\/p>\n\n\n\n<p>\u2018\u7ed1\u5b9a\u5df2\u7ecf\u6253\u5f00\u7684\u5f53\u524d\u6587\u4ef6<br>Set oBook = oExcel.ActiveWorkBook<\/p>\n\n\n\n<p>\u7ed1\u5b9a\u5df2\u6709\u5de5\u4f5c\u8868 Sheet1<br>Set oSheet = oBook.Sheets(&#8220;Sheet1&#8221;)<\/p>\n\n\n\n<p>&#8216;\u65b0\u5efa\u5de5\u4f5c\u8868\u5e76\u7ed1\u5b9a<br>Set oSheet = oBook.Worksheets.Add<br>oSheet.Name = &#8220;New Sheet&#8221;<\/p>\n\n\n\n<p>\u2018\u7ed1\u5b9a\u5df2\u7ecf\u6253\u5f00\u7684\u5f53\u524d\u5de5\u4f5c\u8868<br>Set oSheet = oBook.ActiveSheet<\/p>\n\n\n\n<p>\u2018\u53e6\u5b58\u6587\u4ef6\u5e76\u6307\u5b9a\u683c\u5f0f<br>oBook.SaveAs \u201cD:\/TestBack.xls\u201d, FileFormat:=18 &#8216;Excel Format<\/p>\n\n\n\n<p>\u2018\u9000\u51fa Microsoft Excel \u5e76\u91ca\u653e\u8d44\u6e90<br>oExcel.Quit<br>Set oExcel = Nothing<br>Set oBook = Nothing<br>Set oSheet = Nothing<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8216;\u7ed1\u5b9a Microsoft ExcelDim oExcel As Object &#8216;Mi &hellip; <a href=\"https:\/\/www.wyrcad.com\/?p=765\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cMicrosoft Excel \u57fa\u672c\u64cd\u4f5c\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[24,17],"class_list":["post-765","post","type-post","status-publish","format-standard","hentry","category-bianchengyuandi","tag-vb","tag-biancheng"],"_links":{"self":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/765","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=765"}],"version-history":[{"count":4,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/765\/revisions"}],"predecessor-version":[{"id":772,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/765\/revisions\/772"}],"wp:attachment":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}