[Solved] Macros on Mac and Windows

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
kestrel
Posts: 19
Joined: Mon Dec 19, 2022 6:28 pm

[Solved] Macros on Mac and Windows

Post by kestrel »

I am working on a spreadsheet in both MacOS and Windows 10. Does anybody know if there are any help documents on how to make macros work both in Mac and Windows. I have gone through Getting Started with Macros Guide from Pitonyak and Harris Weber but there is nothing specific in this doc. I had created a paste special macro on my Mac using Command->4 as keystrokes. When I opened the ods file on my Windows laptop was not available and of course it would not have worked because no Command key on my Windows laptop.

Thanks in advance for your help.

Attila
Last edited by MrProgrammer on Thu Mar 30, 2023 5:09 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
Open Office 4.1.6 Mac OS High Sierra 10.13.6
User avatar
Hagar Delest
Moderator
Posts: 32650
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Macros on Apple and Windows

Post by Hagar Delest »

If you try a more conventional keystroke based on the Ctrl key for example, does it work?

Edit: as stated by JeJe below, I assumed that the shortcut was saved in the file (option available in the Customize > Keyboard dialog).
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
JeJe
Volunteer
Posts: 2777
Joined: Wed Mar 09, 2016 2:40 pm

Re: Macros on Apple and Windows

Post by JeJe »

I presume most macros should work cross platform. Where was the macro stored? If it wasn't stored as a document macro but as a user/installation macro it won't be available on Windows because the macro is stored on the Mac.

Edit: You'll also need to make sure macros are enabled for the document on your Windows machine.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
kestrel
Posts: 19
Joined: Mon Dec 19, 2022 6:28 pm

Re: Macros on Apple and Windows

Post by kestrel »

I will try both suggestions when I get back to my MAC. Thanks will report after testing.
Open Office 4.1.6 Mac OS High Sierra 10.13.6
User avatar
MrProgrammer
Moderator
Posts: 4901
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Macros on Apple and Windows

Post by MrProgrammer »

kestrel wrote: Mon Mar 20, 2023 9:52 pm Does anybody know if there are any help documents on how to make macros work both in Mac and Windows.
Getting Started with Macros

kestrel wrote: Mon Mar 20, 2023 9:52 pm I had created a paste special macro on my Mac using Command->4 as keystrokes. When I opened the ods file on my Windows laptop was not available.
When you create a macro on your Mac, you must indicate the name and where to save it. You did not tell us where you saved it. If you saved it in My Macros on your Mac, this is local to the computer and so when you use the Windows computer OpenOffice can't find it because the macro only exists on the Mac. Macros are stored in a library container. In the link above, it's explained that every spreadsheet has a macro library container and OpenOffice has two macro library containers on your computer, one of which, My Macros, is available for your use. You have two choices:
• Create the same macro on the Windows computer and save it in My Macros library container there.
• On the Mac, save the macro in the library container within the spreadsheet where you want to use it.

Saving a Paste Special macro in a spreadsheet's library container does not seem appropriate, because then you wouldn't be able use it when working on other spreadsheets. Personally, I would record a Paste Special macro on the Mac and save it in My Macros there, then record it on Windows and save it in My Macros there. The link above also explains how to export and import a macro, but this will be a lot more work for one which you can record again in 20 seconds. If you've created a keyboard shortcut for the macro on your Mac, importing the macro to Windows does not create a keyboard shortcut there. You still need to create a keyboard shortcut with Tools → Customize → Keyboard on your Windows system.

Read more about macros here: [Tutorial] Favorite Recorded Calc Macros

Hagar Delest wrote: Mon Mar 20, 2023 11:01 pm If you try a more conventional keystroke based on the Ctrl key for example, does it work?
The ⌘ key (Command) on a Mac is the equivalent to the Ctrl key on other systems. For example, the Copy and Paste operations are Ctrl-C and Ctrl-V on Windows, but ⌘C and ⌘V on a Mac. Thus if one uses ⌘4 on a Mac for the macro it would be logical to use Ctrl-4 for it on Windows. Mac's do have a key labelled control but OpenOffice cannot use it to run macros. Macs do not use Ctrl-C and Ctrl-V to copy and paste.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Post Reply