Ask Your Question
1

Auto run macro on open - can't assign to macro in document [closed]

asked 2013-10-02 12:56:59 +0200

jheath gravatar image

This seems like it should be an easy question, but it has me stumped. I have an .ods file that I converted from an Excel .xls file which had an Auto_Open procedure, and the .ods file now has a Standard Library (in the document), Modules under that, and Module1 under that which contains a Main procedure. If I organize macros, select Module1 and click on Assign, I see that Standard.Module1.Main is assigned to Open Document. Note that at the bottom of the Events dialog it says "Save In" and gives the name of the .ods file that I'm opening and that contains the macro. And sure enough, when I open the document, it runs the macro.

Now I create a brand new Calc document, organize macros, create a new Module1 under Standard, it creates a deafult Main procedure there for me, and I add one line: [msgbox "In Main"]. I can run the macro, but when I go to the Organizer and click Assign, I cannot assign it to the Open Document event. If I click the Assign: Macro button, it only gives me the choice of macros in My Macros or in LibreOffice Macros. If you open the organizer from the IDE, it seems like that the "Save In" box only allows a choice of LibreOffice, and I thought this was the problem. But if I open the organizer from within the Calc document itself, it gives me a choice of the .ods document name in the "Save In" box, but if I try to assign a macro, it STILL only gives me the choice of macros in My Macros or in LibreOffice Macros.

Does anyone know what I am doing wrong? Thanks, Jeff

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-10 10:23:43.674853

1 Answer

Sort by » oldest newest most voted
2

answered 2013-10-02 13:35:42 +0200

jheath gravatar image

OK, I stumbled across a work-around. Note that if I use Tools > Macros > Organize Macros > LibreOffice Basic, then click on the Assign button, I can't assign any macros from the local document. BUT if I use Tools > Customize, go to the Events tab, click on Open Document, then click the Macro button, I CAN assign a macro from the local document.

I think this is a bug in LO, or at least a bad design decision, so it would be good if someone could note that in the proper places.

Thanks, Jeff

edit flag offensive delete link more

Comments

Glad I came across your posting as I had a similar problem. I had a Template created in MS Word I wanted to use in LibreOffice. It has an autorun VBA macro. The way you found to assign a macro from the local document works for me too. I was surprised too that the MS VBA code ran without any conversion.

Peter

peterwt gravatar imagepeterwt ( 2015-05-23 19:37:31 +0200 )edit

Excellent answer to a perplexing problem. I would upvote, but apparently I'm not allowed. ("New around here" == gag, apparently.)

Triggerhousinggroup gravatar imageTriggerhousinggroup ( 2016-05-19 15:45:23 +0200 )edit

deleted my q as this thread is closed.. have raised a new q.

Boca gravatar imageBoca ( 2018-02-06 22:23:06 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2013-10-02 12:56:59 +0200

Seen: 6,709 times

Last updated: Oct 02 '13