PC Review


Reply
Thread Tools Rate Thread

Assign Sub Name to a Variable

 
 
Alan
Guest
Posts: n/a
 
      10th Oct 2006
If a string variable "ProductName" can have one of 10 values assigned
to it, is it possible to call a subroutine whose name is the same as
the value of the variable?? If so, can you supply an example please.

 
Reply With Quote
 
 
 
 
John
Guest
Posts: n/a
 
      10th Oct 2006
Hi Alan,

Not that I'm aware of, but you could pass the variable instead?........

Sub FirstProcedure()
Dim ProductName As String
Call ProcessingProcedure(ProductName)
End Sub

Sub ProcessingProcedure(ByVal ProductName As String)
Select Case ProductName
Case "Cat"
'Code here
Case "Dog"
'Code here
Case "Mouse"
'Code here
Case Else
'Code here
End Select
End Sub

Hope that helps

Best regards

John



"Alan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If a string variable "ProductName" can have one of 10 values assigned
> to it, is it possible to call a subroutine whose name is the same as
> the value of the variable?? If so, can you supply an example please.
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      10th Oct 2006
Application.Run ProductName

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Alan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If a string variable "ProductName" can have one of 10 values assigned
> to it, is it possible to call a subroutine whose name is the same as
> the value of the variable?? If so, can you supply an example please.
>



 
Reply With Quote
 
Alan
Guest
Posts: n/a
 
      10th Oct 2006
Thanks guys.

Bob Phillips wrote:
> Application.Run ProductName
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "Alan" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > If a string variable "ProductName" can have one of 10 values assigned
> > to it, is it possible to call a subroutine whose name is the same as
> > the value of the variable?? If so, can you supply an example please.
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Assign JavaScript variable to Jsp Variable Ranjan Microsoft ASP .NET 1 10th Apr 2007 04:35 PM
How to assign the value of the java script variable to a server side variable in C# code behind code? ravindravarman@gmail.com Microsoft Dot NET 1 5th Apr 2007 04:04 PM
How to assign the value of the java script variable to a server side variable in C# code behind code? ravindravarman@gmail.com Microsoft Dot NET 0 5th Apr 2007 07:58 AM
assign variable =?Utf-8?B?VGlt?= Microsoft Excel Programming 10 1st Oct 2004 07:33 PM
Why can't I assign my db to a variable? Laurel Microsoft Access Getting Started 8 4th Feb 2004 05:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:54 PM.