Home Forums General XMetaL Discussion Application.CancelOpenDocument not working Reply To: Application.CancelOpenDocument not working

kschipan

Reply to: Application.CancelOpenDocument not working

I have faced the same problem and just contacted the XMetaL support.

I implemented the macro “On_Application_Before_Document_Open” in order to check if the opening file is a ZIP archive: getPlugin.isZipFile(Application.OpenFileName)
Within our “Plugin” the containing XML files are extracted and opened instead: getPlugin.openSozdokFilesFromZipArchive(Application.OpenFileName)
This really works fantastic.
Since an ZIP file cannot be edited itself with XMetaL, I want to stop the process of opening that file: Application.CancelOpenDocument = True
Unfortunately XMetaL doesn’t  care about this changed property as expected.

This is my macro code:


                MsgBox “Sozdok:On_Application_Before_Document_Open:” & Application.OpenFileName & ” Cancel = ” & Application.CancelOpenDocument, , “SozDok Debug”
               
                If (getPlugin.isZipFile(Application.OpenFileName)) Then
                              getPlugin.openSozdokFilesFromZipArchive(Application.OpenFileName)
                              Application.CancelOpenDocument = True
                End If                 MsgBox “Sozdok:On_Application_Before_Document_Open:” & Application.OpenFileName & ” Cancel = ” & Application.CancelOpenDocument, , “SozDok Debug”
]]>

I also tried the simple thing: Just stopping each opening – it doesn’t seem to work.

                MsgBox “Sozdok:On_Application_Before_Document_Open:” & Application.OpenFileName & ” Cancel = ” & Application.CancelOpenDocument, , “SozDok Debug”
               
                Application.CancelOpenDocument = True
               
                MsgBox “Sozdok:On_Application_Before_Document_Open:” & Application.OpenFileName & ” Cancel = ” & Application.CancelOpenDocument, , “SozDok Debug”
]]>

How can I manage that task?

Reply

Products
Downloads
Support