Skip to content

Commit d435a21

Browse files
committed
Bug fixed: function parsing was broken.
1 parent ac5ed8d commit d435a21

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/VBAexpressions.cls

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4225,14 +4225,26 @@ Private Function ReplaceImpliedMult(expression As String) As String
42254225
Dim tmpPos As Long
42264226
Dim tmpStr As String
42274227
Dim LookupPos As Long
4228+
Dim tmpVar As String
4229+
Dim tmpVarInitPos As Long
42284230

42294231
LookupPos = 1
42304232
tmpStr = expression
42314233
tmpPos = InStrB(LookupPos, tmpStr, d_lParenthesis)
42324234
Do While tmpPos
42334235
If tmpPos > 2 Then
4234-
If InStr(1, op_AllItems, MidB(tmpStr, tmpPos - 2, 2)) = 0 Then 'Implied multiplication found
4235-
tmpStr = MidB(tmpStr, 1, tmpPos - 1) & op_mult & MidB(tmpStr, tmpPos)
4236+
If InStr(1, op_AllItems, MidB(tmpStr, tmpPos - 2, 2)) = 0 Then
4237+
tmpVarInitPos = tmpPos
4238+
Do While tmpVarInitPos > 1
4239+
If (InStrB(1, op_AllItems, MidB$(tmpStr, tmpVarInitPos - 2, 2)) <> 0) Then
4240+
Exit Do
4241+
End If
4242+
tmpVarInitPos = tmpVarInitPos - 2
4243+
Loop
4244+
tmpVar = MidB$(tmpStr, tmpVarInitPos, tmpPos - tmpVarInitPos)
4245+
If GetFunctionName(LCase$(tmpVar)) = vbNullString Then 'Implied multiplication found
4246+
tmpStr = MidB(tmpStr, 1, tmpPos - 1) & op_mult & MidB(tmpStr, tmpPos)
4247+
End If
42364248
End If
42374249
LookupPos = tmpPos + 4
42384250
tmpPos = InStrB(LookupPos, tmpStr, d_lParenthesis)

0 commit comments

Comments
 (0)