ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Evaluating a DDE formula created by strings (https://www.excelbanter.com/excel-worksheet-functions/243074-evaluating-dde-formula-created-strings.html)

JessicaRowe

Evaluating a DDE formula created by strings
 
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



JessicaRowe

Evaluating a DDE formula created by strings
 
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?

Pete_UK

Evaluating a DDE formula created by strings
 
Try these amendments:

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

Hope this helps.

Pete

On Sep 18, 9:32*am, JessicaRowe wrote:
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?




All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com