Help needed with a macro code to add a marker icon
Answered
Hi all,
I'm struggling with the code to programmatic add the below "custom icon 1" to a topic.
Here's the code that I'm using but that is not working.
' Access to marker group "Émoticônes"
On Error Resume Next
Set MarkerGroup = MonDocActif.MapMarkerGroups.Item("Émoticônes")
On Error GoTo 0
'Check if Group Markers exist
If MarkerGroup Is Nothing Then
Exit Sub
End If
' Look for marker "Custom Icon 1"
Set Marker = Nothing
On Error Resume Next
Set Marker = MarkerGroup.MapMarkers.Item("Custom Icon 1")
On Error GoTo 0
' Check if marker exist
If Marker Is Nothing Then
Exit Sub
End If the below line returns an type mismatch error.
Set MarkerGroup = MonDocActif.MapMarkerGroups.Item("Émoticônes")
Any idea?
Thanks a lot

Use the method Topic.AddCustomIconFromMap(signature) if the icon already exists in the map.
The method Topic.AddCustomIcon(filename) will add a custom icon directly from an .ico file. It is interesting that MindManager tries to process this if given some text that is not a file path and name.
Use the method Topic.AddCustomIconFromMap(signature) if the icon already exists in the map.
The method Topic.AddCustomIcon(filename) will add a custom icon directly from an .ico file. It is interesting that MindManager tries to process this if given some text that is not a file path and name.
Is this code from a generative AI tool? The parameter for Document.MapMarkerGroups.Item() is an integer for the 1-inclusive index of the marker group, not the group name. The same applies to markers in a marker group. To find a group by name, you will need to iterate over the collection.
Is this code from a generative AI tool? The parameter for Document.MapMarkerGroups.Item() is an integer for the 1-inclusive index of the marker group, not the group name. The same applies to markers in a marker group. To find a group by name, you will need to iterate over the collection.
---