[Libreoffice-bugs] [Bug 135673] New: VBA 'For Each' statement 'Data type mismatch.' error

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed Aug 12 16:05:58 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=135673

            Bug ID: 135673
           Summary: VBA 'For Each' statement 'Data type mismatch.' error
           Product: LibreOffice
           Version: 7.0.0.3 release
          Hardware: x86-64 (AMD64)
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: dednev at rambler.ru

I have the VBA macros with 'For Each' statements, perfectly working in LO 6.4
and earlier versions. But when I upgraded LO to 7.0.3 I've found, that this
macros gives an error: "Inadmissible value or data type. Data type mismatch.".

I've tried an example from LO help
(https://help.libreoffice.org/7.0/en-US/text/sbasic/shared/03090202.html?DbPAR=BASIC#bm_id3149205):
Sub list_iteration
    cutlery = Array("fork", "knife", "spoon")
    For Each item in cutlery
        Print item
    Next ' item
End Sub

I't doesn't work and gives me exactly the same error.

I've also tried LO unit test
(https://git.libreoffice.org/core/+/0444fbe7515501a7997516e05329e2b2fda00dd3/core/basic/qa/basic_coverage/test_For_loops.vb):

Function doUnitTest
  Dim s1 As Integer, s2 As Integer, value As Integer
  ' FOR EACH
  numbers = Array(3,4,5,6,7,8,9,10,11)
  For Each value in numbers
    s1 = s1 + value
  Next value
  ' FOR .. TO .. STEP ..
  For value = 5 To 21 Step 3
    s2 = s2 + value
  Next value
  If s1<>9*7 Or s2<>3*25 Then
    doUnitTest = 0
  Else
    doUnitTest = 1 'Ok
  End If
End Function

It also produces the same error.

I've checked this problem in Linux under Debian Buster:
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
and using LO win64 build under Windows 10 x86-64 - errors are the same.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200812/55dade35/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list