Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to run a function from a variable

Hello everyone, I have been trying to dynamically run a function that is
stored in a variable (this comes from an Access table). To make to story
short:

strSomeFunction = "ExportRecords"

then I would like to call it:

Run strSomeFunction

There is no EVAL() function - I am not referring to the EVALUATE Excel
function.

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default How to run a function from a variable

Hi,
Try :

strSomeFunction = "ExportRecords"
Application.Run strSomeFunction

Regards.
Daniel

Hello everyone, I have been trying to dynamically run a function that is
stored in a variable (this comes from an Access table). To make to story
short:

strSomeFunction = "ExportRecords"

then I would like to call it:

Run strSomeFunction

There is no EVAL() function - I am not referring to the EVALUATE Excel
function.

Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to run a function from a variable

You can pass parameters in the Run Function.

Run strSomeFunction("ExportRecords")


You SQL statements in Access are string which can take parameter


Function strSomeFunction(Mytable as String)

SQL = ".............table(" & Mytable & ").........................."

end function

The query statements in Access are Strings. You can put a passed parameter
into the SQL string by breaking the string into pices like I done above.
"Gussie" wrote:

Hello everyone, I have been trying to dynamically run a function that is
stored in a variable (this comes from an Access table). To make to story
short:

strSomeFunction = "ExportRecords"

then I would like to call it:

Run strSomeFunction

There is no EVAL() function - I am not referring to the EVALUATE Excel
function.

Any ideas?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to run a function from a variable

Daniel C, got it right.

The strSomeFunction is a string variable that will be loaded with the
function name which is stored in a table, then I can just run it

SQL statement
code
code
strSomeFunction = rsSource!FunctionName

Application.Run strSomeFunction

It works like a charm!


"Joel" wrote:

You can pass parameters in the Run Function.

Run strSomeFunction("ExportRecords")


You SQL statements in Access are string which can take parameter


Function strSomeFunction(Mytable as String)

SQL = ".............table(" & Mytable & ").........................."

end function

The query statements in Access are Strings. You can put a passed parameter
into the SQL string by breaking the string into pices like I done above.
"Gussie" wrote:

Hello everyone, I have been trying to dynamically run a function that is
stored in a variable (this comes from an Access table). To make to story
short:

strSomeFunction = "ExportRecords"

then I would like to call it:

Run strSomeFunction

There is no EVAL() function - I am not referring to the EVALUATE Excel
function.

Any ideas?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to run a function from a variable

Thanks Daniel, it works like a charm.
I missed that command, I looked everywhere but did not think of the
application.

Thx again

"Daniel.C" wrote:

Hi,
Try :

strSomeFunction = "ExportRecords"
Application.Run strSomeFunction

Regards.
Daniel

Hello everyone, I have been trying to dynamically run a function that is
stored in a variable (this comes from an Access table). To make to story
short:

strSomeFunction = "ExportRecords"

then I would like to call it:

Run strSomeFunction

There is no EVAL() function - I am not referring to the EVALUATE Excel
function.

Any ideas?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable Value Function Help? Jonathan Cheek[_2_] Excel Worksheet Functions 2 December 22nd 09 05:33 AM
Variable function ESP Tom Excel Discussion (Misc queries) 1 July 10th 06 09:37 PM
Variable function ESP Tom Excel Discussion (Misc queries) 2 July 10th 06 04:01 PM
Variable function ESP Tom Excel Discussion (Misc queries) 0 July 10th 06 02:15 PM
Add to a variable via a function Cheer-Phil-ly Excel Programming 0 May 26th 06 10:13 PM


All times are GMT +1. The time now is 04:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"