Bug 67254 - VBAProject Macros: Apostrophe (comment indicator) does not cancel underscore (split line) at the end of the line
Summary: VBAProject Macros: Apostrophe (comment indicator) does not cancel underscore ...
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.0.4.2 release
Hardware: Other Windows (All)
: lowest minor
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-24 12:50 UTC by Mateusz
Modified: 2017-02-23 15:47 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
extendedComment.xls: button macro with 'comment _ (22.00 KB, application/vnd.ms-excel)
2017-02-23 15:46 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz 2013-07-24 12:50:35 UTC
Problem description: 
When macro is executed, it is being executed line-by-line.
Line normally is fully executable or fully commented.

However, it is possible to include line such:
(note: this is actual line I got in .xls file):

 ActiveWindow.SelectedSheets.PrintOut Copies:=1 ', Collate:= _
End Sub

Now, after 'Copies:=1' the apostrophe means: "ignore the following text till end_of_the_line.

The funny thing is that at the end of the line is an underscore, and actually it is BEING INTERPRETED.

So in my situation:
 ...
 ActiveWindow.SelectedSheets.PrintOut Copies:=1 ', Collate:= _
End Sub

Sub Print_with_grey_background()
...


The following error pop-up appears:
basic syntax error : sub not allowed within a procedure

However, it is enough to duplicate 'End Sub', or delete underscore sign, and everything is fine.


Steps to reproduce:
1. Description above should be enough
2. ....
3. ....

Current behavior:
When part of the line is commented out with single apostrophe sign, the 'underscore' sign at the end of the line is being parsed 'as designed'

Expected behavior:
When part of the line is commented out with single apostrophe sign, the 'underscore' sign at the end of the line should not be parsed
              
Operating System: Windows 7
Version: 4.0.4.2 release
Comment 1 Cor Nouws 2013-07-26 22:35:44 UTC
Hi Mateusz,

Can you pls try this one?

sub test67254
 msgbox " test 67254" ', Collate:= _
End Sub
end sub

It behaves as expected for me: compains about the extra Sub end
Remark that, and all is fine...
Comment 2 Mateusz 2013-07-27 17:09:04 UTC
(In reply to comment #1)
> Hi Mateusz,
> 
> Can you pls try this one?
> 
> sub test67254
>  msgbox " test 67254" ', Collate:= _
> End Sub
> end sub
> 
> It behaves as expected for me: compains about the extra Sub end
> Remark that, and all is fine...


Hi Cor,

Tanks for checking.
Your script executes well in my LO, without complaining about an extra line.
With two 'end sub' lines. So I guess my version still has a bug.

My OS: Windows 7 Professional.
Language: Polish

LO version: 4.0.4.2 (Build ID: 9e9821abd0ffdbc09cd8c52eaa574fa09eb08f2)
Polish language version.

Regards,
Mateusz
Comment 3 Joel Madero 2014-06-25 05:11:09 UTC
@Noel - thoughts here?
Comment 4 Noel Power 2014-06-25 08:59:51 UTC
(In reply to comment #3)
> @Noel - thoughts here?

it is certainly a bug and since cor can't reproduce it with 'normal' macro calls one would have to suspect that this is a bug that is present in 'VBA' compatibility mode. Therefore I would imagine fairly low priority
Comment 5 QA Administrators 2015-07-18 17:42:54 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2016-09-20 10:18:10 UTC Comment hidden (obsolete)
Comment 7 Pierre Lepage 2016-11-30 03:06:46 UTC
In LO 5.2.3.3, I could not reproduce the bug. In addition, "ActiveWindow" is a method specific to MS-VBA.
Comment 8 Justin L 2017-02-23 15:46:33 UTC
Created attachment 131432 [details]
extendedComment.xls: button macro with 'comment _

(In reply to Cor Nouws from comment #1)
Here is an .xls document containing this macro...

Private Sub CommandButton1_Click()
 MsgBox " test 67254" ', Collate:= _
End Sub

It fails to compile/execute also on MSOffice 2003/2007/2013, so it seems like Microsoft ALSO evaluates an ending _ regardless of whether it is part of a comment or not.

Closing this old issue.  Please provide an example document that works in MSExcel, but fails in LO if you reopen it.