Evaluating a DDE formula created by strings

  • Thread starter Thread starter JessicaRowe
  • Start date Start date
J

JessicaRowe

Hello! This is a very frustrating problem I have been working on for
quite some time and have not been able to come up with a solution.

As you know, DDE formulas are in the form: =APP|TOPIC!'FIELD'

My initial problem is that I can't use cell referencing in these DDE
formules (eg. =APP|TOPIC!'A1' will try to retrieve the piece of data
called A1 rather than pick up the contents of the cell A1.

So then I tried to use a VBA solution by creating a function like so
(off the top of my head):

Function GetValue(App as String, Topic as String, Field as String) As
String
 
Function GetValue(App as String, Topic as String, Field as String) As
String

Dim command as String

command = "="&App&"|"&Topic&"!'"&Field&"'"

GetValue = command

End Function

So then I type in Excel, =GetValue(App,Topic,A1)

And great! The Cell showed =APP|TOPIC!'(Value of cell A1)'

However, how can I get Excel to evaulate the formula, instead of
showing the formula as a string?
 
Try these amendments:

command = App&"|"&Topic&"!'"&Field&"'"
GetValue = Evaluate(command)

Hope this helps.

Pete
 
Back
Top