Issue 92642 - "dim name as String" prompts runtime error "BASIC syntax error"
Summary: "dim name as String" prompts runtime error "BASIC syntax error"
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: stefan.baltzer
QA Contact: Unknown
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-11 03:19 UTC by pflin
Modified: 2013-02-24 21:00 UTC (History)
2 users (show)

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


Attachments
test document that demonstrates the problem. (49.50 KB, text/plain)
2008-08-11 03:19 UTC, pflin
no flags Details
patch for fixing the problem (3.84 KB, text/plain)
2008-08-11 03:20 UTC, pflin
no flags Details
patch to fix the issue (based on dev300 m70) (9.25 KB, text/plain)
2010-02-08 12:09 UTC, ab
no flags Details
Test macro (876 bytes, text/plain)
2010-02-08 12:09 UTC, ab
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description pflin 2008-08-11 03:19:07 UTC
In MSO VBA, "name" can be defined as a variable or a Name object. e.g.

Dim name as String ' name as a variable

Dim n as Name ' Name is a object

But the above macro will throw runtime error "BASIC syntax error" in OOo basic.
Comment 1 pflin 2008-08-11 03:19:40 UTC
Created attachment 55682 [details]
test document that demonstrates the problem.
Comment 2 pflin 2008-08-11 03:20:49 UTC
Created attachment 55683 [details]
patch for fixing the problem
Comment 3 pflin 2008-08-11 03:27:18 UTC
Current patch can support three keywords to be used as variable including Name,
Line, Text. But it has a limit. When a keyword "Name" is dim as a variable, the
"Name" function can not used in the same Subroutine. 

Sub Test()
   dim name as String
   name = "Hello"
   Msgbox name

   Name "c:/tmp/1.txt" As "c:/tmp/2.txt" ' fail
End Sub
Comment 4 kay.ramme 2008-08-11 12:33:13 UTC
Andreas, please take this over ...

Thanks

     Kay
Comment 5 ab 2008-08-29 15:22:23 UTC
I see some problems here. I did some tests in vb6 and
1. vb6 could execute the name command although "name"
has been used as symbol before
2. In vb6 the sample also works without the dim command.
while the patch requires the variable to be dimmed.
I think this solution is only half way.
Comment 6 pflin 2008-09-01 10:52:18 UTC
pflin -> ab,
It is limit to current patch. But it is not easy for me to full support this
feature. ( same behavior as vb6 ). 
Hope you give me some idea about the solution. Thanks. :-)
Comment 7 ab 2008-09-11 14:08:46 UTC
ab->pflin: I doubt that this is easy. Obviously vb somehow uses the signature
to distinguish between the different use cases. I will think over it.
->STARTED, OOo 3.x
Comment 8 ab 2010-02-08 12:09:13 UTC
Created attachment 67702 [details]
patch to fix the issue (based on dev300 m70)
Comment 9 ab 2010-02-08 12:09:59 UTC
Created attachment 67703 [details]
Test macro
Comment 10 ab 2010-03-04 11:42:55 UTC
FIXED
Comment 11 ab 2010-03-04 11:45:54 UTC
ab->sba: Please verify
Comment 12 stefan.baltzer 2010-06-16 16:38:03 UTC
Verified in CWS mib16.
Comment 13 hans_werner67 2010-06-17 12:47:39 UTC
set new target milestone 3.3
Comment 14 stefan.baltzer 2010-11-17 10:23:08 UTC
OK in OOO330_m15.
Closed.