Bug 142063 - Writer and Calc macro problems with update to LO
Summary: Writer and Calc macro problems with update to LO
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2021-05-03 17:20 UTC by Lew
Modified: 2022-03-21 18:33 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:


Note You need to log in before you can comment on or make changes to this bug.
Description Lew 2021-05-03 17:20:40 UTC
I'm in the position of [this OP](https://ask.libreoffice.org/en/question/207552/how-can-i-import-a-macro-bas-file-into-calc/?answer=307533#post-id-307533).  The answer included the statement **"Installing a new version of LO should have no effect on macros."**  Three notes. 

1) I've updated before, and the statement above has been true. Very good to be able to rely on that.

2) I just updated to (x64), Win 10, and I lost ALL my macros and assigned keystrokes. Luckily I had a *.bas file from Nov 2020. **The process in that answer worked.** But I had to reassign my keystrokes, and all changes since then are lo, And if I hadn't exported to bas in Nov I'd have to go back even further. I'd much rather avoid this.

3) So far, I can't save **one macro** that sets a date **to Ctrl-Shft-T in Writer** (to start a journal entry) and save **a different macro** that puts a date in a cell **to Ctrl-Shft-T in Calc**.  I used to be able to do this, and it was good since conceptually they do the same thing (date an entry). Now after setting one in Writer (Writer radio button is set), when I switch to Calc the same macro appears even though the Calc radio button is set. If I choose the macro I designed for Calc, the Writer one is replaced in Writer. 

I can use different keystrokes for Calc/Writer and be sure to manually back up all my macros before updating. But (a) #2 above isn't great, and (b) my old functionality in #3 above used to work, which seems intentional because of the radio buttons.

Steps to Reproduce:
1. create 2 user macros in an earlier version and assign one to CTRL-SHFT-T in writer and the other to CTRL-SHFT-T in Calc.
2. save the macros in a *.bas file.
3. Update to
4. All macros and keystroke assignments were gone for me
5. Import the macros created in #1.
6. Assign macro A to CTRL-CHFT-T in Calc. Radio button for Calc should be showing. (I didn't see one for Writer.)
7. Assign macro B to CTRL-CHFT-T in Writer. Radio button for Writer should be showing. (I didn't see one for Calc.)
8. In Calc, check the keystroke assignment -- it should show macro B.

Actual Results:
Different macros can't be assigned to the same keystroke combination in Calc and Writer.

Expected Results:
? I used to be able to update without losing macros and key assignments. I used to be able to assign different macros to the same keystroke combination in Calc and Writer.

Reproducible: Always

User Profile Reset: Yes

OpenGL enabled: Yes

Additional Info: (x64)
build https://git.libreoffice.org/core/+log/8a45595d069ef5570103caea1b71cc9d82b2aae4
cpu threads 12
O/S win 10 bulid 19041
interface UI render SkiaVulkan; VCL; win
locale: en-US; UI en-US

Below: "When noticing strange behavior in LibreOffice the first thing to do is to reset the user profile. To do so, 2 methods are available."

Please put those steps somewhere Earlier in this reporting process. 

I'm a user, not a programmer. I've already lost 1 1/2 hours to researching and finding a workaround for these problems. This included searching the web for how to import *.bas, since the topic doesn't seem to be in the online help system.

I don't have that kind of time. Rather than installing something for opengl (if I need to) and rebooting my system for the profile and entering all this information again, I'm going to submit without it. Sorry, but I have other things I need to do.
Comment 1 Roman Kuznetsov 2021-08-15 15:36:43 UTC
When you used a Customize dialog in Writer did you select "Writer" on Keyboard tab? 
The same question for Calc: When you used a Customize dialog in Calc did you select "Calc" on Keyboard tab?

Are you sure you didn't change it to LibreOffice?

and else one: your problem is in the loss of all your macro after LO updating or in impossibility to assign different macro to the same shortcut for different LO modules?
Comment 2 Lew 2021-08-16 14:14:59 UTC
When I customize I've always noticed that the choice of program (writer/calc) is the app that I started in. If I'm in calc, the customizing is for calc. I've never knowingly chosen LO.

The problem was only that I lost them all. Never happened before. I was able to load my backup *.bas file and restore everything. I can customize normally.

To be complete: 

I don't do a lot of LO programming. Currently I have 39 macros, all stored in My Macros/Standard/Module1/*main*. Poor form, but I'm not a pro. Most are old, experiments, and not used, but the ones that I use are part of my normal workflow because they are real time savers.

When I updated, my Module1/*main* was simply empty.
Comment 3 QA Administrators 2021-08-17 03:50:33 UTC Comment hidden (obsolete)
Comment 4 tking.6 2021-09-16 21:39:48 UTC
I experienced the same problem after upgrading to  Sheets with macros that I had used for years no longer loaded the macros associated with the spreadsheet.  The ones under MYMACROS were still there but don't run from there.  They have to be attached to the spreadsheet.

After a lot of testing, saving the file as .ODS, that retained the macros when the sheet is reloaded.  To verify, open LO calc (it will be named Untitled 1): go to Tools: Scroll down to Macros: select Edit Macros: Click on Untitled 1:  The item Standard will appear below Untitled:  Go to the row of icons and click on the one next to the question mark (Modules):  Make sure the window on the 3rd row contains Untitled:  Position the cursor on the word Standard:  Click the New button:  A new module window will appear:  Click its OK button:  Module 1 will now appear below Standard:  A window will open showing a Sub Main line and an End Sub line.  Click Save under file and save as an .XLS file:

Now open the sheet, go to Tools, select Macros, edit Macros, and Click on Untitled 1, then Standard, the macro will be gone.  Rebuild the macro by clicking on the Module icon next to the question mark (same steps as above).  Go to File and select Save As an .ODS sheet.  Close the sheet.  Reload it and go to Tools and Macros: Edit Macros and scroll through the selections and the macro will there.

More testing revealed that spreadsheets created prior to work correctly.  After I loaded, my macros in .XLS files don't load.

Based on this, there is a setting in .XLS saves / loads that is not being processed properly or there is some missing code associated with that handles .XLS saves / loads.

I'm running W10 home.
Comment 5 Timur 2021-09-17 06:59:46 UTC
2 issues here:
- we should have sample macro attached that worked before but it doesn't work in 7.1.2
- you should check that one with 7.2.2 (when available) because of fixed bug 144085.