I'm searching for a way to call a VBA macro from another document.When I'm running e.g.: Application.GMSManager.RunMacro "GlobalMacros", "Test.ZMenExec", pIdthis works, but If I replace 'GlobalMacros' with the name of my module, it does not work anymore
Now it works:A click on a command button does the following:First it scans all open documents to find a document where a property is set to true. If found then it stores in this document the active layer in the active page. Then it searches for an alternative layer in the same page.This layer get's activated, a new property is set to the document and the previously active layer get's activated again.The document itself has a procedure which is started when a layer is activated. This procedure reads out the property and set's the value then to zero. Depending on that value the needed procedure is started.That's it! I tried this way also on Saturday, but somehow this did not work.I also spend some ideas to the option to have some very generic macros in the GMS-Area, but I fear, this is not usable for me: I have placed 2 computers on different locations and work on both computers on the same projects. My CDR-Files are in the DropBox, so they get synchronized there. But I did not saw a way to create a common file located also in the DropBox.Thanks to all who supported me in finding this way!
So, in your installation do document events work?
In my case (X8 64bit) they don't. I asked about this issue on a separate thread, in order to understand if this is a general behavior starting from X8 or my installation has a problem... If I remember well you work in 2017. Is that correct?
In my installation (X8) events works only in Untitled documents. After document saving THEY DO NOT WORK any more! I kept uninstalling and reinstalling for a lot of times and the same behavior...
I started asking myself if they didn't invent trusted locations like in Excel and forgot to document that...
Can anybody else confirm that in his X8 64bit installation document events work?
Thanks in advance!
First I thought it might have to do something with the name of the document, since my 'FFW_Tool_17.Cdr' has a pretty short name, I tried to open a different PrgDoc with a longer name (I avoid special characters and spaces in my names, so I do not really have a chance to use a terrible named document for such a test), opened WorldMap_02_17.cdr by clicking in the explorer on it, did the modifications needed to work with that controls and tried it: Nothing happens!Then I opened the other tool - again from the explorer -> Did not work as well.As written before I work from different locations on different computers on files saved in the cloud. I also have a generic CDR-File with commonly used functions and procedures. When I open this ToolBox in the DropBox-Folder and set a reference to it in my current document, Corel does not recognize it.The only way to make this running I saw until now, is:In a Batch file I change the current directory to the folder with my toolbox and start then with following line Corel, the ToolBox and my current project at once:"C:\Program Files\Corel\CD17\Programs64\CorelDRW.exe" ToolBox01_17.Cdr %MyProj%When I open my environment that way, it works, if I close my document and reopen it, it does not work anymore.This investigations I did now with 2017, but for the successful test I did yesterday under X8 I started it the same way.Who can explain this?
Somehow the entire stuff becomes mystic:Since I have also some Documents which do not need the toolbox I feared also some problems there. So I started to update one with the needed routines opened it 'stand alone' with a right click on it in the explorer and open with 2017 -> This worked as well, but only until an error occurred. After a restart (and a fix in the environment to avoid this error) it worked fine (I did not any programming stuff inside during this test).Then I saved it under X8 (with a warning, that after this step all VBA stuff gets lost, but it was present after I opened it under X8), due to the fact that I have not the GMS updated I changed the action of the module triggered by the ActivateLayer to a beep and each call of activation a different layer caused a beep.Then I saved it and closed it, but kept Corel open, reopened it -> Nothing happened. Then I closed Corel and reopened it with a click on the document in the explorer -> After I activated the macros, it worked.Somehow it looks, that those events work only, if the document had been opened directly with Corel. Very Strange!
You should be happy that at least found a way to make them working.
in my installation events do not work in any condition!
I installed uninstalled and reinstalled it many times. I do not have it installed in program files. Because of space lack on C, I installed it on a different partition. Logically it shouldn't matter. But if voodoo works in your case I will try extending of SO partition and after that reinstalling on that. Not now, when I will have some time for such a thing which looks idiotic for me...
Please confirm that your X8 installation is on ProgramFiles.
Under X8 I use exact that command to start my PgrDoc's:"C:\Program Files\Corel\CDX8\Programs64\CorelDRW.exe" ToolBox01X8.Cdr %MyProj%My program path isn't also the default path, for sure the CDX8 is an abbreviation done by my (I hate long path names containing spaces and special characters), but - for sure it's at least on the Default Prg-Folder.
I have also - on my laptop - the needs to have Corel installed on D:\ - when I find some spare time the next days I will look, if it works there as well and will inform you about the result