I am at the start of converting my Routeworks application to a MP Add-In.
Command buttons on the frmAddIn call a database functions form or a map functions form each of which have command buttons for all the things a route manager needs to do.
The first button I've tried to code in, in Map Functions, shows some data about the dataset and routes in the map file.
The following code compiles ok but gives me a variable not set error followed by an automation error.
I've blocked out all the important code lines planning to reintroduce them 1 at a time untill I corrected the error. The error occurs as soon as the line set objMap is read.
If I remove this line also, the see details form shows, but of course it's dead.

Someone help? Thanks.

Public Connect As Connect
Public objApp As MapPoint.Application

Private Sub cmdViewDetails_Click()

Dim txtShowDataSetCount As String
Dim intShowDataSetCount As Integer
Dim objDatasets As MapPoint.DataSets
Dim objDataset As MapPoint.DataSet
Dim iInt As Integer
Dim objMap As MapPoint.Map
iInt = 1

Set objMap = objApp.ActiveMap
' Set objDatasets = objMap.DataSets

'intShowDataSetCount = objMap.DataSets.Count
'txtShowDataSetCount = "This map has " & CStr(intShowDataSetCount) & " datasets/routes."
'frmMapDetails.lblListDatasets.Caption = txtShowDataSetCount

' frmMapDetails.lstDatasetNames.Clear
' For Each objDataset In objDatasets
' frmMapDetails.lstDatasetNames.AddItem (objDatasets.Item(iInt).Name)
' iInt = iInt + 1
' Next objDataset
frmMapDetails.Show vbModal

End Sub