Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default VBA Equivalent of ASP 'Execute' Command

Is there a VBA equivalent of ASP's 'Execute' command. I'd like to use such
a command to dynamically declare variables at run-time.

Here's a sample of ASP 'Execute' code.

---------------------------
varID = fp_rs("ID")
varName = fp_rs("Name")
varOccupation = fp_rs("Occupation")

for i = 1 to numFields
Execute("var" & arr_fieldnames(i) & " = fp_rs(""" & arr_fieldnames(i) &
""")"
next

---------------------------

Thanks,
Wayne C.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default VBA Equivalent of ASP 'Execute' Command


"The Vision Thing" wrote in message
...
Is there a VBA equivalent of ASP's 'Execute' command. I'd like to use

such
a command to dynamically declare variables at run-time.

Here's a sample of ASP 'Execute' code.

---------------------------
varID = fp_rs("ID")
varName = fp_rs("Name")
varOccupation = fp_rs("Occupation")

for i = 1 to numFields
Execute("var" & arr_fieldnames(i) & " = fp_rs(""" & arr_fieldnames(i) &
""")"
next

---------------------------

Thanks,
Wayne C.



I think Application.Evaluate is what you are looking for.

/Fredrik


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default VBA Equivalent of ASP 'Execute' Command

Are you executing a different program?

Take a look at Shell in VBA's help.

Are you running a different subroutine?

Application.Run

maybe it.

The Vision Thing wrote:

Is there a VBA equivalent of ASP's 'Execute' command. I'd like to use such
a command to dynamically declare variables at run-time.

Here's a sample of ASP 'Execute' code.

---------------------------
varID = fp_rs("ID")
varName = fp_rs("Name")
varOccupation = fp_rs("Occupation")

for i = 1 to numFields
Execute("var" & arr_fieldnames(i) & " = fp_rs(""" & arr_fieldnames(i) &
""")"
next

---------------------------

Thanks,
Wayne C.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default VBA Equivalent of ASP 'Execute' Command


"Fredrik Wahlgren" wrote in message
...

"The Vision Thing" wrote in message
...
Is there a VBA equivalent of ASP's 'Execute' command. I'd like to use

such
a command to dynamically declare variables at run-time.

Here's a sample of ASP 'Execute' code.

---------------------------
varID = fp_rs("ID")
varName = fp_rs("Name")
varOccupation = fp_rs("Occupation")

for i = 1 to numFields
Execute("var" & arr_fieldnames(i) & " = fp_rs(""" & arr_fieldnames(i) &
""")"
next

---------------------------

Thanks,
Wayne C.



I think Application.Evaluate is what you are looking for.

/Fredrik



I don't think Application.Evaluate solves the problem. I want to
dynamically declare variables and assign values like so:-

For i = 1 to Ubound(arrIn)
Dim ("var" & i) as string
("var" & i) = arrIn(i)
Next

Regards,
Wayne C.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default VBA Equivalent of ASP 'Execute' Command


"Dave Peterson" wrote in message
...
Are you executing a different program?

Take a look at Shell in VBA's help.

Are you running a different subroutine?

Application.Run

maybe it.

The Vision Thing wrote:

Is there a VBA equivalent of ASP's 'Execute' command. I'd like to use
such
a command to dynamically declare variables at run-time.

Here's a sample of ASP 'Execute' code.

---------------------------
varID = fp_rs("ID")
varName = fp_rs("Name")
varOccupation = fp_rs("Occupation")

for i = 1 to numFields
Execute("var" & arr_fieldnames(i) & " = fp_rs(""" & arr_fieldnames(i) &
""")"
next

---------------------------

Thanks,
Wayne C.


--

Dave Peterson


What I'm trying to do is dynamically declare variables and assign values to
them, like so

For i = 1 to Ubound(arrIn)
Dim ("var" & arrIn(i)) as string
("var" & arrIn(i)) = arrIn(i)
Next

Regards,
Wayne C.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default VBA Equivalent of ASP 'Execute' Command

VBA doesn't support that kind of symbolic substitution.

The Vision Thing wrote:

"Dave Peterson" wrote in message
...
Are you executing a different program?

Take a look at Shell in VBA's help.

Are you running a different subroutine?

Application.Run

maybe it.

The Vision Thing wrote:

Is there a VBA equivalent of ASP's 'Execute' command. I'd like to use
such
a command to dynamically declare variables at run-time.

Here's a sample of ASP 'Execute' code.

---------------------------
varID = fp_rs("ID")
varName = fp_rs("Name")
varOccupation = fp_rs("Occupation")

for i = 1 to numFields
Execute("var" & arr_fieldnames(i) & " = fp_rs(""" & arr_fieldnames(i) &
""")"
next

---------------------------

Thanks,
Wayne C.


--

Dave Peterson


What I'm trying to do is dynamically declare variables and assign values to
them, like so

For i = 1 to Ubound(arrIn)
Dim ("var" & arrIn(i)) as string
("var" & arrIn(i)) = arrIn(i)
Next

Regards,
Wayne C.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default VBA Equivalent of ASP 'Execute' Command

Thanks Dave, that's what I needed to know.

Wayne C.

"Dave Peterson" wrote in message
...
VBA doesn't support that kind of symbolic substitution.

The Vision Thing wrote:

"Dave Peterson" wrote in message
...
Are you executing a different program?

Take a look at Shell in VBA's help.

Are you running a different subroutine?

Application.Run

maybe it.

The Vision Thing wrote:

Is there a VBA equivalent of ASP's 'Execute' command. I'd like to use
such
a command to dynamically declare variables at run-time.

Here's a sample of ASP 'Execute' code.

---------------------------
varID = fp_rs("ID")
varName = fp_rs("Name")
varOccupation = fp_rs("Occupation")

for i = 1 to numFields
Execute("var" & arr_fieldnames(i) & " = fp_rs(""" &
arr_fieldnames(i) &
""")"
next

---------------------------

Thanks,
Wayne C.

--

Dave Peterson


What I'm trying to do is dynamically declare variables and assign values
to
them, like so

For i = 1 to Ubound(arrIn)
Dim ("var" & arrIn(i)) as string
("var" & arrIn(i)) = arrIn(i)
Next

Regards,
Wayne C.


--

Dave Peterson



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default VBA Equivalent of ASP 'Execute' Command

I'm not sure there aren't better ways to achieve this - declaring
variables on the fly is not really good practise. You would be much
better off using a dictionary object or array for what you're trying
to do.


Tim.


"The Vision Thing" wrote in message
...
Thanks Dave, that's what I needed to know.

Wayne C.

"Dave Peterson" wrote in message
...
VBA doesn't support that kind of symbolic substitution.

The Vision Thing wrote:

"Dave Peterson" wrote in message
...
Are you executing a different program?

Take a look at Shell in VBA's help.

Are you running a different subroutine?

Application.Run

maybe it.

The Vision Thing wrote:

Is there a VBA equivalent of ASP's 'Execute' command. I'd like
to use
such
a command to dynamically declare variables at run-time.

Here's a sample of ASP 'Execute' code.

---------------------------
varID = fp_rs("ID")
varName = fp_rs("Name")
varOccupation = fp_rs("Occupation")

for i = 1 to numFields
Execute("var" & arr_fieldnames(i) & " = fp_rs(""" &
arr_fieldnames(i) &
""")"
next

---------------------------

Thanks,
Wayne C.

--

Dave Peterson

What I'm trying to do is dynamically declare variables and assign
values to
them, like so

For i = 1 to Ubound(arrIn)
Dim ("var" & arrIn(i)) as string
("var" & arrIn(i)) = arrIn(i)
Next

Regards,
Wayne C.


--

Dave Peterson





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
How do I execute command from button or hyperlink? rerhart Excel Discussion (Misc queries) 1 February 18th 05 09:41 PM
Command button - won't execute twice in sequence L Mehl Excel Programming 6 October 15th 04 07:45 PM
Programming command button to execute on a different worksheet Ed[_21_] Excel Programming 4 July 29th 04 12:17 AM
Execute a menu command with VBA? Susan[_3_] Excel Programming 2 May 1st 04 07:45 AM
Execute a command line app but i want a string returned. dei Excel Programming 0 October 23rd 03 08:18 AM


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

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

About Us

"It's about Microsoft Excel"