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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...