![]() |
| サイトマップ | |
|
トップ | オブジェクト | プロパティ | メソッド | 定数 |
SelectedText プロパティ |
オブジェクト:ReportItem , MacroItem
ReportItem オブジェクトにある現在選択状態のテキストを返します。テキストの選択範囲を設定したり返すには、SelectionExtent プロパティを使います。
Dim NotebookItems$() ReDim NotebookItems$(ActiveDocument.NotebookItems.Count) Dim Index Index = 0 Dim index2 index2=0 Dim ReportList$(ActiveDocument.NotebookItems.Count) Dim Item For Each Item In ActiveDocument.NotebookItems If ActiveDocument.NotebookItems(Index).ItemType = 5 Then ReportList$(Index2) = ActiveDocument.NotebookItems(Index).Name index2=index2+1 End If Index = Index + 1 Next Item Begin Dialog UserDialog 320,119,"Report Items in Active Notebook" ' %GRID:10,7,1,1 OKButton 210,14,90,21 ListBox 20,14,170,91,ReportList(),.ListBox1 End Dialog Dim dlg1 As UserDialog Dialog dlg1 Dim SelectedReport SelectedReport=dlg1.ListBox1 Begin Dialog UserDialog 400,168,"Insert Text" ' %GRID:10,7,1,1 TextBox 40,35,310,91,.TextBox1,1 Text 40,7,310,21,"Text to insert at beginning of report:",.Text1 OKButton 100,140,90,21 CancelButton 200,140,90,21 End Dialog Dim dlg2 As UserDialog Dialog dlg2 Dim RepObj As Object Set RepObj=ActiveDocument.NotebookItems(ReportList$(SelectedReport)) RepObj.Open Dim selection(3) selection(0) = 0 selection(1) = 0 RepObj.SelectionExtent = selection RepObj.SelectedText=dlg2.TextBox1 + vbCrLf