{"id":695,"date":"2017-05-12T11:55:04","date_gmt":"2017-05-12T02:55:04","guid":{"rendered":"https:\/\/knowhow.hirohiro716.com\/?p=695"},"modified":"2026-04-07T10:07:57","modified_gmt":"2026-04-07T01:07:57","slug":"libreoffice-calc%e3%81%aevb%e3%81%a7%e3%82%b7%e3%83%bc%e3%83%88%e3%82%84%e3%82%bb%e3%83%ab%e3%82%92%e6%93%8d%e4%bd%9c%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/weblog.hirohiro716.com\/?p=695","title":{"rendered":"LibreOfficeCalc\u306eVB\u3067\u30b7\u30fc\u30c8\u3084\u30bb\u30eb\u3092\u64cd\u4f5c\u3059\u308b"},"content":{"rendered":"<p>\u9078\u629e\u4e2d\u306e\u30bb\u30eb\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentSelection.RangeAddress.StartRow\r\nThisComponent.CurrentSelection.RangeAddress.EndRow\r\nThisComponent.CurrentSelection.RangeAddress.StartColumn\r\nThisComponent.CurrentSelection.RangeAddress.EndColumn\r\n<\/pre>\n<p>\u30bb\u30eb\u3092\u9078\u629e\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nDim dispatcher As Object\r\ndispatcher = createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)\r\nDim args(0) as new com.sun.star.beans.PropertyValue\r\nargs(0).Name = &quot;ToPoint&quot;\r\nargs(0).Value = &quot;$A$4&quot;\r\ndispatcher.executeDispatch(ThisComponent.CurrentController.Frame, &quot;.uno:GoToCell&quot;, &quot;&quot;, 0, args())\r\n<\/pre>\n<p>\u30bb\u30eb\u3092\u9078\u629e\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentController.Select(ThisComponent.Sheets.getByIndex(0).getCellByPosition(0, 5))\r\nThisComponent.CurrentController.Select(ThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getCellRangeByName(&quot;A2:C2&quot;))\r\n<\/pre>\n<p>\u30bb\u30eb\u304b\u3089\u6570\u5024\u306e\u53d6\u5f97\u3068\u3001\u30bb\u30eb\u306b\u6570\u5024\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByIndex(0).getCellByPosition(0, 5).getValue()\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getCellRangeByName(&quot;A2&quot;).setValue(1234)\r\n<\/pre>\n<p>\u30bb\u30eb\u304b\u3089\u6587\u5b57\u5217\u306e\u53d6\u5f97\u3068\u3001\u30bb\u30eb\u306b\u6587\u5b57\u5217\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentController.ActiveSheet.getCellByPosition(3, 0).getString()\r\nThisComponent.CurrentController.ActiveSheet.getCellRangeByName(&quot;B1&quot;).setString(&quot;test1&quot;)\r\n<\/pre>\n<p>\u30bb\u30eb\u306b\u95a2\u6570\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentController.ActiveSheet.getCellRangeByName(&quot;B5&quot;).setFormula(&quot;=SUM(B1:B4)&quot;)\r\n<\/pre>\n<p>\u30bb\u30eb\u306e\u884c\u3068\u5217\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByIndex(0).getCellByPosition(4, 0).CellAddress.Column\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getCellByPosition(3, 0).CellAddress.Row\r\n<\/pre>\n<p>\u30bb\u30eb\u306e\u6587\u5b57\u306b\u8272\u4ed8\u3051\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByIndex(0).getCellByPosition(4, 0).CharColor = rgb(255,0,0)\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getCellRangeByName(&quot;A1:A2&quot;).CharColor = rgb(255,0,0)\r\n<\/pre>\n<p>\u30bb\u30eb\u306e\u80cc\u666f\u306b\u8272\u4ed8\u3051\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByIndex(0).getCellByPosition(4, 0).CellBackColor = rgb(0,255,0)   \r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getCellRangeByName(&quot;A1:A2&quot;).CellBackColor = rgb(0,255,0)\r\n<\/pre>\n<p>\u7bc4\u56f2\u3092\u6307\u5b9a\u3057\u3066\u30bb\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nDim sheet As Object\r\nsheet = ThisComponent.Sheets.getByIndex(0)\r\n&#039;\u9078\u629e\u7bc4\u56f2\u3092\u30b3\u30d4\u30fc\u3059\u308b\r\nsheet.copyRange(sheet.getCellRangeByName(&quot;\u30b3\u30d4\u30fc\u5148&quot;).getCellAddress(), sheet.getCellRangeByName(&quot;\u30b3\u30d4\u30fc\u5143&quot;).getRangeAddress())\r\n&#039;\u884c\u3092\u30b3\u30d4\u30fc\u3059\u308b\r\nsheet.copyRange(sheet.getCellRangeByName(&quot;A1&quot;).getCellAddress(), sheet.Rows(1).getRangeAddress())\r\n<\/pre>\n<p>\u6307\u5b9a\u7bc4\u56f2\u306e\u5185\u5bb9\u3084\u66f8\u5f0f\u3092\u3059\u3079\u3066\u30af\u30ea\u30a2\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByIndex(0).getRows.getByIndex(4).clearContents(511)\r\n<\/pre>\n<p>\u6307\u5b9a\u7bc4\u56f2\u306e\u5024\u306e\u307f\u3092\u30af\u30ea\u30a2\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getRows.getByIndex(6).clearContents(7)\r\n<\/pre>\n<p>\u6307\u5b9a\u7bc4\u56f2\u306e\u5024\u3068\u6570\u5f0f\u306e\u307f\u3092\u30af\u30ea\u30a2\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getRows.getByIndex(6).clearContents(23)\r\n<\/pre>\n<p>\u6307\u5b9a\u7bc4\u56f2\u3092\u524a\u9664\u3059\u308b\u3002<br \/>\n(\u7b2c\u4e8c\u5f15\u6570\uff1a1=UP\u30012=LEFT)<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nDim sheet As Object\r\nsheet = ThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;)\r\nsheet.removeRange(sheet.getCellRangeByName(&quot;A3:D10&quot;).RangeAddress, 1)\r\n<\/pre>\n<p>\u884c\u3092\u9078\u629e\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentController.Select(ThisComponent.Sheets.getByIndex(0).getRows.getByIndex(0))\r\n<\/pre>\n<p>\u884c\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getRows.insertByIndex(3, 1) &#039;\u633f\u5165\u4f4d\u7f6e\/\u8ffd\u52a0\u884c\u6570\r\n<\/pre>\n<p>\u884c\u3092\u524a\u9664\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByIndex(0).getRows.removeByIndex(3, 1) &#039;\u524a\u9664\u4f4d\u7f6e\/\u524a\u9664\u884c\u6570\r\n<\/pre>\n<p>\u884c\u306e\u9ad8\u3055\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getRows().getByIndex(3).height = 750 &#039;0.75cm\r\n<\/pre>\n<p>\u5217\u3092\u9078\u629e\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentController.Select(ThisComponent.Sheets.getByIndex(0).getColumns.getByIndex(0))\r\n<\/pre>\n<p>\u5217\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getColumns.insertByIndex(3, 1) &#039;\u633f\u5165\u4f4d\u7f6e\/\u8ffd\u52a0\u5217\u6570\r\n<\/pre>\n<p>\u5217\u3092\u524a\u9664\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByIndex(0).getColumns.removeByIndex(3, 1) &#039;\u524a\u9664\u4f4d\u7f6e\/\u524a\u9664\u5217\u6570\r\n<\/pre>\n<p>\u5217\u306e\u5e45\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getColumns().getByIndex(0).width = 2000 &#039;2cm\r\n<\/pre>\n<p>\u5165\u529b\u898f\u5247\u3092\u524a\u9664\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.getByIndex(0).getColumns.getByIndex(5).Validation.Type = 0\r\n<\/pre>\n<p>\u5370\u5237\u7bc4\u56f2\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentController.ActiveSheet.setPrintAreas(Array(sheet.getCellRangeByName(&quot;A1:E30&quot;).getRangeAddress()))\r\n<\/pre>\n<p>\u73fe\u5728\u306e\u30b7\u30fc\u30c8\u3092\u53d6\u5f97\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentController.ActiveSheet\r\n<\/pre>\n<p>\u30b7\u30fc\u30c8\u306e\u5b58\u5728\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.hasByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;)\r\n<\/pre>\n<p>\u30b7\u30fc\u30c8\u3092\u9078\u629e\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.CurrentController.Select(ThisComponent.Sheets.getByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;).getCellRangeByName(&quot;A1&quot;))\r\n<\/pre>\n<p>\u30b7\u30fc\u30c8\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.insertNewByName(&quot;\u65b0\u898f\u30b7\u30fc\u30c8\u540d&quot;, 0)\r\n<\/pre>\n<p>\u30b7\u30fc\u30c8\u3092\u524a\u9664\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.removeByName(&quot;\u30b7\u30fc\u30c8\u540d&quot;)\r\n<\/pre>\n<p>\u30b7\u30fc\u30c8\u3092\u30b3\u30d4\u30fc\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.Sheets.copyByName(&quot;\u30b3\u30d4\u30fc\u5143&quot;, &quot;\u65b0\u3057\u3044\u30b7\u30fc\u30c8\u540d&quot;, 0) &#039;\u5148\u982d\u306b\u8ffd\u52a0\r\nThisComponent.Sheets.copyByName(&quot;\u30b3\u30d4\u30fc\u5143&quot;, &quot;\u65b0\u3057\u3044\u30b7\u30fc\u30c8\u540d&quot;, ThisComponent.Sheets.getCount()) &#039;\u672b\u5c3e\u306b\u8ffd\u52a0\r\n<\/pre>\n<p>\u30b7\u30fc\u30c8\u3092\u4fdd\u8b77\u3001\u89e3\u9664\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nsheet.Protect(&quot;password&quot;)\r\nsheet.Unprotect(&quot;password&quot;)\r\n<\/pre>\n<p>\u81ea\u52d5\u518d\u8a08\u7b97\u3092\u7121\u52b9\u306b\u3059\u308b\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nThisComponent.enableautomaticCalculation(False)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9078\u629e\u4e2d\u306e\u30bb\u30eb\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3002 ThisComponent.CurrentSelection.RangeAddress.StartRow ThisComponent.CurrentSelection.RangeAddres [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-695","post","type-post","status-publish","format-standard","hentry","category-libreoffice-calc"],"views":4473,"_links":{"self":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=695"}],"version-history":[{"count":24,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/695\/revisions"}],"predecessor-version":[{"id":3196,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/695\/revisions\/3196"}],"wp:attachment":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}