** [[OOobbs/113]] [#ne4bda09] -''サマリ'': コメントの全表示、非表示、削除マクロ -''環境'': Calc -''状態'': 投稿 -''投稿者'': [[はにゃ?]] -''投稿日'': 2006-09-23 (土) 18:17:07 *** 質問 [#g82652dd] Calc のアクティブシート上のコメントの全表示、非表示、削除を行うマクロ。 *** 回答 [#s90af44f] 全表示用 Sub Show_AllComments() Dim oDoc As Object, oSheet As Object Dim oAnnos As Object Dim oEnum As Object, oElm As Object oDoc = ThisComponent If oDoc.supportsService( _ "com.sun.star.sheet.SpreadsheetDocument" ) Then oSheet = oDoc.CurrentController.getActiveSheet() oAnnos = oSheet.getAnnotations() oEnum = oAnnos.createEnumeration() While oEnum.hasMoreElements() oEnum.nextElement().setIsVisible(true) WEnd End If End Sub 全非表示用 Sub Hide_AllComments() Dim oDoc As Object, oSheet As Object Dim oAnnos As Object Dim oEnum As Object, oElm As Object oDoc = ThisComponent If oDoc.supportsService( _ "com.sun.star.sheet.SpreadsheetDocument" ) Then oSheet = oDoc.CurrentController.getActiveSheet() oAnnos = oSheet.getAnnotations() oEnum = oAnnos.createEnumeration() While oEnum.hasMoreElements() oEnum.nextElement().setIsVisible(false) WEnd End If End Sub 全削除用 Sub Remove_AllComments() Dim oDoc As Object, oSheet As Object Dim oAnnos As Object Dim oEnum As Object, oElm As Object oDoc = ThisComponent If oDoc.supportsService( _ "com.sun.star.sheet.SpreadsheetDocument" ) Then oSheet = oDoc.CurrentController.getActiveSheet() oAnnos = oSheet.getAnnotations() For i = 0 To oAnnos.getCount -1 oAnnos.removeByIndex(i) Next i End If End Sub #comment |