<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - VBA 'For Each' statement 'Data type mismatch.' error"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=135673">135673</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>VBA 'For Each' statement 'Data type mismatch.' error
</td>
</tr>
<tr>
<th>Product</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0.0.3 release
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>BASIC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dednev@rambler.ru
</td>
</tr></table>
<p>
<div>
<pre>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
(<a href="https://help.libreoffice.org/7.0/en-US/text/sbasic/shared/03090202.html?DbPAR=BASIC#bm_id3149205">https://help.libreoffice.org/7.0/en-US/text/sbasic/shared/03090202.html?DbPAR=BASIC#bm_id3149205</a>):
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
(<a href="https://git.libreoffice.org/core/+/0444fbe7515501a7997516e05329e2b2fda00dd3/core/basic/qa/basic_coverage/test_For_loops.vb">https://git.libreoffice.org/core/+/0444fbe7515501a7997516e05329e2b2fda00dd3/core/basic/qa/basic_coverage/test_For_loops.vb</a>):
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>