0
マクロを初めて作成したので、このエラーの意味や解決方法がわかりません。誰も私に助言することはできますか?どんな助けもありがとう。私はいくつかの解決策を試したと言いたいと思いますが、私が言うように、これは私が初めてだから、何を試してもわからないのです。SharpDevelopのマクロエラーが宣言されていません
Public Sub DeleteUnusedViews()
'define current document
Dim currentDoc As Document = Me.Application.ActiveUIDocument.Document
'get all views
Dim viewCollector = New FilteredElementCollector(currentDoc)
viewCollector.OfCategory(BuiltInCategory.OST_Sheets)
'create list of views to delete
Dim viewsToDelete As New List(Of View)
'loop through views and check if it's on a sheet
For Each curView As View In viewCollector
'check if view is a template
If curView.IsTemplate = False Then
'check if view can be added to sheet
If Viewport.CanAddViewToSheet(currentDoc, sheetCollector.FirstElement.Id, curView.Id) = True Then
'add view to delete list
viewsToDelete.Add(curView)
End If
End If
Next
'create transaction
Dim curTrans As New Transaction(currentDoc)
curTrans.Start("Delete unused views")
'delete views in list
For Each curViewToDelete As View In viewsToDelete
currentDoc.Delete(curViewToDelete.Id)
Next
'commit changes
curTrans.Commit
curTrans.Dispose
'alert the user
TaskDialog.Show("Deleted Views", "Deleted " & viewsToDelete.Count & " views.")
End Sub