Bug 35596

Summary: Cannot name macro "Green()"
Product: LibreOffice Reporter: jkonecny
Component: BASICAssignee: Noel Power <nopower>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium CC: augsod, rb.henschel
Version: 3.3.0 release   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description jkonecny 2011-03-23 09:24:14 UTC
Strange unless I am doing something wrong...  When Application.Run calls "Green" I get an error "macro does not exist.  If I name it anything other than Green (including other color names) it works ok.  It also works if I call it by running...

Application.Run Green instead of Application.Run "Green".

REM - Does not work
Option VBASupport 1
Sub Green()
  msgbox "You called the Green macro!"
End Sub

Sub test()
   Application.Run "Green"
End Sub

REM - Works
Option VBASupport 1
Sub Green()
  msgbox "You called the Green macro!"
End Sub

Sub test()
   Application.Run Green
End Sub

REM - Works
Option VBASupport 1
Sub Greenx()
  msgbox "You called the Green macro!"
End Sub

Sub test()
   Application.Run "Greenx"
End Sub
Comment 1 Katarina Behrens 2011-03-24 06:43:15 UTC
Noel, please have a look, I'm not sure if this is bug or feature
Comment 2 Noel Power 2011-03-24 08:03:31 UTC
I'll take a look, sounds weird, I would nearly bet there is some RTL 'Green' function that is causing confusion
Comment 3 Regina Henschel 2011-03-24 15:26:29 UTC
Green, Red and Blue are build-in Basic functions, see alphabetic list in the help.
Comment 4 jkonecny 2011-03-24 17:03:35 UTC
Well that would make the VBA macros incompatible with excel I believe.  This came in from an excel sheet where it worked.
Comment 5 August Sodora 2012-01-08 11:00:53 UTC
Is there a way to restore VBA compatibility without breaking applications that use Red/Green/Blue from the basic runtime? Perhaps detecting Option VBASupport 1 is enough?

Also shouldn't the error message be something more like "Macro already exists" than "Macro does not exist"?
Comment 6 Noel Power 2012-01-09 04:14:54 UTC
(In reply to comment #5)
> Is there a way to restore VBA compatibility without breaking applications that
> use Red/Green/Blue from the basic runtime? Perhaps detecting Option VBASupport
> 1 is enough?
> 

there is and I thought that I fixed this issue previously ( or at least the rtl function visibility part ) :-/ There was previously a flag that could be set to flag mark an RTL function to be only available in compatibility mode, I extended that to also be able to set a flag to mark a function only available in 'libreoffice' basic mode. ( see. _COMPTMASK, _COMPATONLY & _NORMONLY ) in basic/source/runtime/stdobj.cxx )

however it seems this does not work as expected at the moment, the behaviour currently is that a function deemed to be available in compatibility mode is indeed not available until 'Option VBASupport 1' is set, however once that option is enabled the function is available forever more ( until the office is restarted ). Similarly a function that is specified as unavailable in compatibility mode will be unavailable as long as 'Option VBASupport 1' is specified, but... after the first time the function is called in non-compatibility mode then the function will always be found.

It seems that in openoffice the previous incarnation ( e.g. setting a function to be available in compat mode only ) also exhibits the same problem. Its not clear whether this was always the behaviour or not ( clearly it's not desirable ) Not even sure what the correct 

> Also shouldn't the error message be something more like "Macro already exists"
> than "Macro does not exist"?

one might say that probably should be a compile time error, but I doubt that the basic compiler is smart enough to realise this as it resolves nearly everything at runtime.

Note: there seems to be an additional problem here in that 

Application.Run "Green" will not resolve, the current implementation expects at least the Module to be specified ( note: in a standalone example e.g not an imported document you would need to specify the complete location  Application.Run "Standard.Module1.Green" as the project name is not correctly set up )
Comment 7 QA Administrators 2014-06-25 17:37:58 UTC
Please read this message in its entirety before responding.

Your bug was confirmed at least 1 year ago and has not had any activity on it for over a year. Your bug is still set to NEW which means that it is open and confirmed. It would be nice to have the bug confirmed on a newer version than the version reported in the original report to know that the bug is still present -- sometimes a bug is inadvertently fixed over time and just never closed.

If you have time please do the following:
1) Test to see if the bug is still present on a currently supported version of LibreOffice (preferably 4.2 or newer).
2) If it is present please leave a comment telling us what version of LibreOffice and your operating system.
3) If it is NOT present please set the bug to RESOLVED-WORKSFORME and leave a short comment telling us your version and Operating System

Please DO NOT
1) Update the version field
2) Reply via email (please reply directly on the bug tracker)
3) Set the bug to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:
https://wiki.documentfoundation.org/QA/BugTriage

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.