Gets a query from the query library.
Load(SavedQuery As Query) As Boolean
Returns True on success.
SavedQuery
The query is made current. Note that this method does not load a query from an external file.
The following example shows how to set a saved query to the member of the QueryCategories collection you want to load, call Load, and execute the loaded query. Before running this code, attach a drawing, and save a query in the query library by running the Query.Save example. To go to Query.Save, click .
Dim amap As AcadMap
Dim prj As Project
Dim qry As Query
Dim mainqrybr As QueryBranch
Dim qrylf As QueryLeaf
Dim boolVal As Boolean
Dim i As Integer, cqryct As Integer
Dim j As Integer, cqry As Integer
Dim sqry As SavedQuery
Set amap = ThisDrawing.Application. _
GetInterfaceObject("AutoCADMap.Application")
Set prj = amap.Projects(ThisDrawing)
prj.CurrQuery.Clear
For i = 0 To prj.QueryCategories.Count - 1
If prj.QueryCategories(i).Name = "DrawingCategory" Then
cqryct = i
End If
Next i
For j = 0 To prj.QueryCategories.Item(cqryct).Count - 1
If prj.QueryCategories.Item(cqryct).Item(j).Name = "myInternalquery" Then
cqry = j
End If
Next j
Set sqry = prj.QueryCategories.Item(cqryct).Item(cqry)
boolVal = prj.CurrQuery.Load(sqry)
boolVal = prj.CurrQuery.Execute
ThisDrawing.Application.ZoomExtents