Saves the current query to the query library or an external file.
Save( External As Boolean, _
kSaveOptions As ESaveQueryOptions, _
Category As String, _
Name As String, _
Description As String, _
Filename as String _
) As Boolean
Returns True on success.
External
kSaveOptions
Category
Name
Description
Filename
The following example first saves a query with a description and a category name in an external file and then also saves it in the query library. You pass an empty string, as shown in the second call to Query.Save, instead of a file name to save the query in the library.
Dim amap As AcadMap
Dim prj As Project
Dim qry As Query
Dim mainqrybr As QueryBranch
Dim qrylf As QueryLeaf
Dim boolVal As Boolean
Set amap = ThisDrawing.Application. _
GetInterfaceObject("AutoCADMap.Application")
Set prj = amap.Projects(ThisDrawing)
Set qry = prj.CurrQuery
qry.Clear
Set mainqrybr = qry.QueryBranch
Set qrylf = mainqrybr.Add(kLocationCondition, kOperatorAnd)
boolVal = qrylf.SetLocationCond(kLocationInside, _
prj.MapUtil.NewLocationAll)
qry.Mode = kQueryDraw
boolVal = qry.Define(mainqrybr)
'Only if C:\\query.qry does not exist continue -- code not shown
boolVal = qry.Save( _
True, 0, "DrawingCategory", "myExternalquery", _
"Qry on disk", "C:\\query.qry")
boolVal = qry.Save( _
False, 0, "DrawingCategory", "myInternalquery", _
"Qry in library", "")