Wednesday, 24 January 2018

mapbasic - How to close all layers in Mapinfo?


I want to close all layers in Mapinfo except one and again add one layer. How to do so in Mapinfo using Mapbasic or without?




Answer



This will close all layers except one using a layer name to check what to keep open:


Dim i as Integer
Dim tables as Integer
Dim tableName as String

tables = NumTables()

For i = 0 To tables
tableName = TableInfo(i,TAB_INFO_NAME)

'' Check to see if the table is anything but the one we are looking for.
If Not tableName = "{Your table name to check here}" Then
Close Table tableName
End If
Next

No comments:

Post a Comment