Issue 77338 - 2 or more numerical labels cause compile error in Basic
Summary: 2 or more numerical labels cause compile error in Basic
Alias: None
Product: General
Classification: Code
Component: ui (show other issues)
Version: OOo 2.2
Hardware: PC All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2007-05-14 10:23 UTC by hba
Modified: 2017-05-20 10:47 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description hba 2007-05-14 10:23:49 UTC
Steps to reproduce the behaviour in OOo-dev 2.2.0:

1) Start an application (eg Writer or Calc).
2) Open the OOo-dev Basic Macros dialog (Tools/Macros/Organize Macros/OOo-dev 
3) Create a new macro in the new document.
4) Create a new module in the new document.
5) Edit the Main macro of this module in the macro editor so that it looks 
like this:

Sub Main
End Sub

6) Try to compile or run the sub (or just close the Basic window and open it 
7) A message box with the following error message appears:

BASIC syntax error.
Label $(ARG1) already defined.

The behaviour could be reproduced in:
  i) OOo-dev 2.2.0
 ii) OOo 2.2 Build 2
iii) OOo 2.1

The error message in the Hungarian builds (only included here to aid Hungarian 

BASIC szintaktikai hiba.
A címke már létezik $(ARG1).

1) One numerical label (with or without further non-numerical labels) doesn't 
cause the error.
2) More code doesn't seem to prevent the error.
3) This issue could be divided into 2 sub-issues:
   i) Not accepting 2 or more numerical labels.
   ii) Displaying $(ARG1) instead of the actual label name.
4) This issue may make VBA macro conversion a bit more difficult.
5) Quick fix: replace numerical labels with non-numerical labels.

For this, you can use the following regular expression and replace string:

Search for:


Replace with:


(This didn't work for me in the Find and Replace function of the Basic editor,
try the Find and Replace function of Writer instead.)
Comment 1 thorsten.martens 2007-05-14 11:33:04 UTC
TM->JSK: please have a look.
Comment 2 hba 2007-05-14 14:31:59 UTC
Sorry for the mistake, the intended steps are of course:

3) Create a new module in the new document.
4) (You don't have to create Sub Main since it is created automatically.)
Comment 3 hba 2007-05-22 15:54:16 UTC
I'm sorry for the long description.
Below is a brief version to aide easy confirmation.

Write any OOo Basic code containing two or more numerical labels (with or 
without colons) and it won't compile.
The simplest sub to demonstrate the effect:

Sub Main
End Sub
Comment 4 kpalagin 2007-06-10 16:18:38 UTC
Confirming with OO2.2 on WinXP - 
"Sub Main
End Sub"
produces error message 
"Basic syntax error.
Label $(ARG1) already defined".
Comment 5 joerg.skottke 2008-06-17 09:56:03 UTC
To AB, set target 3.x
Comment 6 ab 2008-08-01 11:29:14 UTC
Comment 7 Marcus 2017-05-20 10:47:44 UTC
Reset assigne to the default "".