Evaluating a DDE formula created by strings

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
 
J

JessicaRowe

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?
 
P

Pete_UK

Try these amendments:

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

Hope this helps.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top