Link to home
Start Free TrialLog in
Avatar of tnilesh2
tnilesh2Flag for India

asked on

Problem in Macro codes "With CreateObject("VBscript.RegExp")"

Dear Experts,
We are using some customized fuctions (codes attached below).

In most of the PC's / users it works fine but in some PC's / users it does not works & returns error - "#VALUE".

We found that below mentioned codes are not working in some users -

With CreateObject("VBscript.RegExp")
    .Global = True
    .Pattern = "[0-9]*\.?[0-9]+"
    Set oMatches = .Execute(r2)
End With

These users are using MS Excel 2007.

We have checked all the basic settings (like Macro Security, Options, etc), all settings are same as other PC's in which the codes are working fine.

Please suggest how to resolve this issue.

Regards,
Nilesh.
Private Function Film(r2 As Range, r3 As Range) As Double

Dim oRgx As Object, oMatches As Object

With CreateObject("VBscript.RegExp")
    .Global = True
    .Pattern = "[0-9]*\.?[0-9]+"
    Set oMatches = .Execute(r2)

End With

Film = Application.Round(oMatches(1) / 1000 * oMatches(2) / 1000 * oMatches(3) * (1000 / r3), 3)

End Function

Open in new window

Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

If you have windows XP see if VBScript.DLL is present in windows\system32. If you are working with some other windows then check the location of this file on a computer where it works.

Saqib
Check their system32 directory for this file

vbscript.dll

If the file is present then Close Excel and click on Windows Start ~~> Run and type this

regsvr32 vbscript.dll

and press enter.

Now Try it.

Sid
lolzzz Same Time but slow fingers ;)

Sid
lagta hai ke post karne se pehlay cheenk mari thi is liye deir ho gaee
ha ha ha ha
Avatar of tnilesh2

ASKER

Thanks both of you,

The file "vbscript.dll" is missing. Can I copy & paste it from some other user?

Please suggest.

Regards,
Nilesh.
ASKER CERTIFIED SOLUTION
Avatar of SiddharthRout
SiddharthRout
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.