Description: When I assign a Event-Driven Macros and it is saved in the current document, there is no assignment of the macro to the event after reopening that document. Steps to Reproduce: 1.Make macros 2. Assing it to Event-Driven Macros 3.Save and Close document 4. Reopen document Actual Results: No saved Event-Driven Macros in reopened document Expected Results: Event-Driven Macros in reopened document sould be present Reproducible: Always User Profile Reset: No Additional Info: no
in 7.3.2.2 same problem
*** Bug 147159 has been marked as a duplicate of this bug. ***
You assign a macro to some event? Did you try with different events? User Profile Reset: indicates you should try to rename LO user profile. You need to save macros separately.
Created attachment 179797 [details] Assign evant macros
Created attachment 179798 [details] save and close doc
Created attachment 179799 [details] Reopened doc
(In reply to Timur from comment #3) > You assign a macro to some event? Did you try with different events? Yes. I tried other one. > User Profile Reset: indicates you should try to rename LO user profile. You > need to save macros separately. Не совсем понял что и как надо сделать.
I confirm with Lo 7.4+ that event-driven macro saves in ODT or ODS but not in Micorsoft formats, tested XLS, XLSX, DOC, DOCX. But it's a duplicate. *** This bug has been marked as a duplicate of bug 107960 ***
Can be a duplicate of bug 107960 but let's keep separate so far.
(In reply to Timur from comment #9) > Can be a duplicate of bug 107960 but let's keep separate so far. It is looks like not the same bug.
Created attachment 182687 [details] formfieldMacros.docm: macro on fileOpen, checkbox1 click repro 7.5+ This is a FILEOPEN problem. Round-tripping this file still works fine in Excel. DOC format is a bit better than this. At least on initial file-open the checkbox1 and commandButton macros are working. LO doesn't work on a RT though. DOCX format has never worked in LO. ActiveX support first came in LO 6.0 via bug 50097, but event-macros were never working.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/8253b8d6f1efb7fc3e2928d543c21a79c2cdc13f tdf#148806 docm: fix vba macro events without ScriptCodes It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
DOCX: in terms of sending DOCUMENT OPEN to VBA, all the plumbing looks to be in place. The only problem is an exception in mxVbaEvents.set( ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "com.sun.star.script.vba.VBATextEventProcessor" , aArgs ) because no hasServiceName("com.sun.star.script.vba.VBATextEventProcessor") Somehow we need this? extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* Writer_SwVbaEventsHelper_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args) { return cppu::acquire(new SwVbaEventsHelper(args, context)); }
A proposed patch for exposing document open/close/new to VBA macros is at http://gerrit.libreoffice.org/c/core/+/140801 DOC round-trip losing macros: I just want to confirm that MS Word handled the round-tripped file just fine. In LO, it fails at forms/source/misc/InterfaceContainer.cxx:119 Reference< XModel > xDoc( getXModel( static_cast< XContainer *> ( this ) ) ); if ( !xDoc.is() ) break; // ROUND-TRIPPED file hits this.
> DOC round-trip losing macros: This never worked for the checkboxes. ActiveX checkboxes were round-tripped as FormField's until LO 6.0's commit b45446fcb4958b13bc94e70e2d3d1940db3322e2 Author: Tamás Zolnai on Tue Aug 22 23:40:56 2017 +0200 tdf#111975: Inline checkbox control's label is not saved to DOC format This MiserableFormFieldExportHack lives from the beginning of the git history: 7155b11b7eac65e242aca1efaf29ffcfa28f2564 So it might be a workaround of an old issue. By now when the checkbox is not inline, but a floating one, it is exported as ActiveX control, which works nicely. So just remove this workaround and let the code export also inline checkboxes as ActiveX controls. Did it ever work for the button? On import, the macro got wired back up in LO 5.2 with commit 1f7a31a461bb3a6fcd277ab57875405875568f8b Author: Stephan Bergmann on Tue May 10 10:08:35 2016 +0200 Missing break in switch which was broken 5 years earlier with commit 4fae740db79d4e7cc97440e2bab8d1ef612d9b51 Author: Noel Power on Fri Aug 12 00:36:51 2011 -0400 Disable fake VBA events for the old-style form controls.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/acc71c3e502f23daaf2489d102dda3b00a45960a tdf#148806 sw vba: fix GetVbaEventProcessor It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
(In reply to Justin L from comment #14) > In LO, it fails at forms/source/misc/InterfaceContainer.cxx:119 In the working case, we have parents uno::Reference to (frm::ODatabaseForm *) uno::Reference to (frm::OFormsCollection *) // ends here on RT import uno::Reference to (SwXTextDocument *)
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/d02962cb2ca4e691634abb1bf6ff30b9b366d2e3 tdf#148806 doc import: remove 2003 SetObjectShell(nullptr) hack It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
There is another way that can auto-execute a macro in Word - if a module AutoOpen exists with a PUBLIC SUB MAIN. (PRIVATE doesn't work, FUNCTION doesn't work, any other name than MAIN doesn't work, and it doesn't work if a sub AutoOpen exists) This is different from Excel's auto_open (which is already mostly working in LO) which has no such thing with special modules AFAICS. Some current Calc differences: -In LO, we have first-come, first-served when multiple auto_open subroutines defined. In Excel it gives error "Ambiguous name detected: auto_open" (but note that in Word it is also first come, first served). -in both LO and Excel, auto_open() in ThisWorkbook is ignored. It doesn't run or cause a conflict (but note that in Word it does run and has priority) -in Excel, if an Auto_Open module exists, it PREVENTS "sub auto_open" from running (but note that in Word it just overrides AutoOpen.main).
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/6834fda784f3066a89838cd6cda4fe945f4c7904 related tdf#148806 xls/x vba: no auto_open if Auto_Open module It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/21c0b368a3e7150fc5d18af5d568d5683a7a6a3a tdf#148806 doc vba: AutoOpen runs before Document_Open It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/3d77fe0af515830001448fde0d394ef20a89002b tdf#148806 doc vba: highest priority is ThisDocument AutoOpen It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/e2abb5bbc03cca884fa89345003d013688f0d94d tdf#148806 doc vba: accept module AutoOpen.Main It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/d72571fdd47c627efcd0dff92fbe8a9747f92932 related tdf#148806 flatten filter/source/msfilter/msvbahelper.cxx It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/eaa38b0f9d672793af500222348a6cacd28910b0 tdf#148806 doc vba: only autoOpen PUBLIC macros It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/195cb01573cbc92545cbc84cbb7dd09bbb4ae692 tdf#148806 fix build for !HAVE_FEATURE_SCRIPTING It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ffc15725b58d0988b4e2ed836c5751223ad00984 tdf#148806 tdf#151393 xls vba: no Auto_Open from ThisWorksheet It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/73911ed8d35294a9e15771d8aaa1e9121ef10309 tdf#148806 doc vba: highest priority is ThisDocument AutoOpen V2 It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Just to be clear - I'm using this bug report to handle opening and round-tripping of MS formats related to new/open/close. That should be fixed now. For the enhancement of LO being able to modify VBA event-macros, use bug 105813 for that.
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/1e0306be6c3a3bc50f11e7c7814aa8a029f8928d tdf#148806 vba: IsCompiled is required for SbxFlagBits::Private It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Created attachment 183002 [details] autoOpenClose.dot: manual testing document LO cannot save changes to VBA Macros, so I used the CLOSE event to design a manual test. The changes made by Tools - Macros - Edit Macros will affect the close - but will not be saved. Manual testing -open autoOpenClose.dot: -AutoNew SUBROUTINE (from module AutoNew) runs first -demonstrates autorun order -Document_New runs second – a special ThisDocument event. -save as .doc or .docm and close: -nothing is seen on close (all AutoClose are private) and Document_Close is disabled. -open round-tripped file. -AutoOpen.Main adds text, demonstrating AutoOpen MODULE autorun. -also demonstrates docm and round-tripping support. -change VBA - make AutoClose.Main public -close: demonstrating Private should not autorun -change VBA - same as before plus make AutoClose.AutoClose public -close: demonstrates that AutoClose subroutine has priority, and only one AutoClose runs. -change VBA - same as before plus make aaaSorting.AutoClose public -close: demonstrates first found autorun is the only one activated. -change VBA - same as before plus change module name to zzzSorting -close: again demonstrating first come, first served. -change VBA - same as before plus make ThisDocument.AutoClose public -close: demonstrating ThisDocument priority. I attempted an automated test at https://gerrit.libreoffice.org/c/core/+/141077, but the TypeText always outputs to the top of the document, which is not correct.
Created attachment 183003 [details] autoOpenClose.xls: Excel VBA is completely different from Word Manual testing -open autoOpenClose.xls -Workbook_Open runs first, Auto_Open runs second -close: nothing happens -demonstrating that an Auto_Close MODULE prevents autorun -demonstrates that an Auto_Close.Main subroutine couldn't work either. -change VBA: rename module to xxxAuto_Close -close: In Excel, compile error because there are multiple Auto_Close subroutines. -I didn't handle this case. Just treating like Word - first come, first served. -change VBA: same as before, plus delete Auto_Close_Duplicate -close: this is the only one that works in Excel. -demonstrates that PRIVATE Auto_Close SHOULD run. -change VBA: delete modules Auto_Close and Auto_Close_Duplicate -close: nothing happens -demonstrates that THISWORKSHEET.Auto_Close subroutine does nothing.