Hi Paul

Thanks for the reply. I am using excel 2003.

I learnt about xll files only through google search. I dont have any Idea
how to make an xll file or how to use an existing one.

Do you know how to evaluate this?

x = " = Y(1,1).Value1"

where value1 is a property of a variable defined in a class module. Notice
that the argument is stored as a string.

The Evaluate() function doesn't work as it is for the workbook object and
not for VBA

Actual code I am using is below:

Inside the class module named "MySpreadSheet"

Option Explicit
Private pFormula1 As String
Private pValue1 As Variant
Property Let Formula1(Text)
pFormula1 = Text
End Property
Property Get Formula1()
Formula1 = pFormula1
End Property
Property Let Value1(Value As Variant)
pValue1 = Value
End Property
Property Get Value1()
Value1 = pValue1
End Property
Sub Calculate()
On Error GoTo Err:
'This is where I dont know what to do!
pValue1 = Evaluate(pFormula1)
Exit Sub
Err:
pValue1 = "#ERROR! " & Err.Description
End Sub



This is the code inside a normal module:
Option Explicit
Public X() As New MySpreadSheet
Public Y() As New MySpreadSheet
Sub Test()
Dim mRow, mColumn As Integer
ReDim Preserve X(1 To 10, 1 To 10)
ReDim Preserve Y(1 To 10, 1 To 10)
X(1, 1).Formula1 = "=Y(1,1).Value1"
Y(1, 1).Value1 = "Hello Wrold"
For mRow = 1 To UBound(X, 1)
For mColumn = 1 To UBound(X, 2)
X(mRow, mColumn).Calculate
Next mColumn
Next mRow
MsgBox CStr(X(1, 1).Value1)
End Sub


Result I want is "Hello World"

But I am getting "ERROR 2015"


Please run this code and suggst me if there is any way to evaluate a string
argument

With regards

Hemant Hegde

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe

Reply via email to