Bug 57723 - Can't use VBA-compatible constant in Const variable
Summary: Can't use VBA-compatible constant in Const variable
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected)
3.5.4 release
Hardware: All All
: medium major
Assignee: LeMoyne Castle
Depends on:
Reported: 2012-11-30 07:52 UTC by NOKUBI Takatsugu
Modified: 2015-02-11 20:01 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description NOKUBI Takatsugu 2012-11-30 07:52:51 UTC
The follwoing is the example:

Option VBASupport 1
Option Explicit

Public Const MESSAGE As String "Foo" & vbNewLine & "Bar"

The code treated as a syntax error.

To replace chr(13) instead of vbNewLine also cases error.

Can I use CR/CRLF code with constant string?
Comment 1 LeMoyne Castle 2012-12-22 03:42:02 UTC
Confirmed in 3.6.3 on Ubuntu 10.04...

' NOGO>>> Const NEWLINE As String = Chr(13)
Const NEWLINE As String = "  ouch  "

' NOGO>>> Public Const MESSAGE As String = "Foo " & Chr(10) & Chr(13) & " Bar"
' NOGO>>> Public Const MESSAGE As String = "Foo " & VbCrLf & " Bar"
' NOGO>>> Public Const MESSAGE As String = "Foo " & NEWLINE & " Bar"
Public Const MESSAGE As String = "Foo " & " Bar"

It seems that one can use the & to concatenate, but everything to the right of = must be string literal.  I think this is working as designed.  However, it is not an unreasonable enhancement to be able to use named constants as well.  

Want to check VBA action and VBA/LibO BASIC documentation.  Might be a dropout in the VBA compatibility.
Comment 2 QA Administrators 2015-01-05 17:52:32 UTC
** Please read this message in its entirety before responding **

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present on a currently supported version of LibreOffice (4.3.5 or later): https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior

If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case)

Thank you for your help!

-- The LibreOffice QA Team
Comment 3 Buovjaga 2015-01-29 10:11:21 UTC
We need to restest this, but reproduction steps are not clear enough. Setting to NEEDINFO.
Comment 4 QA Administrators 2015-02-11 20:01:49 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INVALID due to inactivity and a lack of information which is needed in order to accurately reproduce and confirm the problem. We encourage you to retest your bug against the latest release. If the issue is still present in the latest stable release, we need the following information (please ignore any that you've already provided):

a) Provide details of your system including your operating system and the latest version of LibreOffice that you have confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED and we will attempt to reproduce the issue. 

Please do not:
a) respond via email 
b) update the version field in the bug or any of the other details on the top section of FDO
Message generated on: 2015-02-11