Trouble with the VBA commands to execute the Export to Mind Manager via Word

  • 1
  • Problem
  • Updated 3 years ago
Hello fellow Mindjetters!

I've been trying to automate the creation of a Mind Map from a saved webpage. I've successfully used 'pandoc' to convert the .html file into a usable .docx format - and I can run the export to Mind Manager great manually - the Map is created as I'd expect hierarchically.

I've been struggling over the weekend to get the export to MM automated. I attempted to record a Word macro - but the 'Send to Mind Manager' button click event is not captured. I used 'Ctrl & Alt & + to capture the button click event - but it gives an erroneous result that the command being executed is 'ViewNormal'

i've tried the following

Sub callMMExport()
Dim addin As COMAddIn
Dim automationObject As Object
'Set addIn = Application.COMAddIns("Mindjet.Mm15Word.AddIn.9")
Set addin = Application.COMAddIns.Item("Mindjet.Mm15Word.AddIn.9")
'Set automationObject = addin.Object
'Call automationObject.Mm5WordCallback.ButtonSendTo
Result = CallByName(addin, "ButtonSendTo", VbMethod)
'Call addIn("ButtonSendTo")

End Sub

and other variants

Can anyone help out with this? - I'm finding this language anything but basic at the moment

Best regards
/Eamonn

P.S. I did go down the road of Powershell automation for a while - but I believe it's a Dead End - as the MM methods I need are not exposed to automation

$mm = new-object -comobject mindmanager.Application # create a com object interface (mm application)

I can get info on the .ActiveDocument - but can't run Open, Import etc

Photo of Eamonn Edwardo

Eamonn Edwardo

  • 11 Posts
  • 2 Reply Likes
  • frustrated

Posted 3 years ago

  • 1
Photo of Nick Duffill

Nick Duffill, Champion

  • 512 Posts
  • 170 Reply Likes
Eamonn

The MM COM automation object that exposes objects such as ActiveDocument is a direct connection to the MindManager server itself. This will already be connected and controlled by the Word addin "Mindjet.Mm15Word.AddIn.9" so you would be short-circuiting the Word addin by connecting straight to MindManager.

This Word add-in probably does not possess any methods or properties beyond IDTExtensibility2, so you might not be able to do much even if you can get a pointer to it. It will be calling MindManager methods to generate the map. You could carry out the export yourself, but it will be a very large quantity of code.

Instead of trying to find and fire the ribbon tab command associated with the Add-in, could you send Alt+H+Y to Word instead? (In Word you can see the ribbon shortcut keys by pressing Alt, then the letter for the tab).

best regards
Nick

As an aside, it is entirely possible for add-ins to include other public methods in their interface, creating a little API for the add-in itself. This would be good general practice for MindManager add-in developers to adopt, including Mindjet themselves. Top of the list would be a property that temporarily stops an add-in from catching events while I do something really special to the map :) The same principle could be used for add-ins in other hosts, to facilitate what you are trying to do here.
(Edited)
Photo of Eamonn Edwardo

Eamonn Edwardo

  • 11 Posts
  • 2 Reply Likes
Hi Nick, Thanks for taking the time to address my question.

I've had some success with the SendKeys method you outlined - but I've had to build in a lot of wait events to allow for what seems like time for the document to fully open, wait for Selection.WholeStory, Selection.Fields.Unlink Then wait again after SendKeys executes etc.

It'll get through what I need it for at the moment - longer term I think pandoc would be better placed to generate the xml for the .mmap files directly (If I can only get my head round xml transformations)

Many many thanks
/Eamonn

As an aside - when I reference the addin in VIsual Studio it addin appears to me to expose the following
Function LoadImages(pbstrImageId As String) As stdole.IPictureDisp
Member of Mm5WordLib.Mm5WordCallback
Function IsSendToVisible(ByVal pRibbonControl As Object) As Boolean
Member of Mm5WordLib.Mm5WordCallback
Function IsSendToEnabled(ByVal pRibbonControl As Object) As Boolean
Member of Mm5WordLib.Mm5WordCallback
Sub ButtonSendTo(ByVal pRibbonControl As Object)
Member of Mm5WordLib.Mm5WordCallback
Sub OnLoad(ByVal pRibbonUI As Object)
Member of Mm5WordLib.Mm5WordCallback

/Eamonn
Photo of Alex Gooding

Alex Gooding, Champion

  • 874 Posts
  • 220 Reply Likes

Hi Eamonn, it's a funny coincidence that your latest post on exporting converted web pages from Word to MindManager should turn up at around the same time that I posted on my much more modest efforts on exporting task lists, also from Word to MM.

Your post has also made me realise how little I know about macros and programming. I now suspect that there are probably far more elegant ways to do what I was attempting to achieve. I'm curious however about what you are trying to do with the website conversions and why specifically you want to automate the Word-to-MM process.