Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 12-04-2013, 08:47 AM
BobBridges's Avatar
BobBridges BobBridges is offline Can a function or sub be called using a variable name? Windows 7 64bit Can a function or sub be called using a variable name? Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Oh, I see. But his question (it seems to me) isn't about passing values to subroutines; it's about calling a variable subroutine. Sort of like this:
Code:
Select Case MyVar
  Case 1 To 7: SubName = "MySub_" & MyVar
  Case "Binge": SubName = "MaxTime"
  Case "Micro": SubName = "Micro"
  Case Else: SubName = ""
  End Select
If SubName <> "" Then Call SubName
That won't work, but what he's asking (I think) is how to do that sort of thing. If MyVar happens to be 5, then he wants his program to Call MySub_5; if it's "Binge" he wants to Call MaxTime; and so on.
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can a function or sub be called using a variable name? object variable or with block variable not set MJP143 Excel 1 02-11-2013 05:07 AM
Can a function or sub be called using a variable name? Run-time error '91': Object variable or With block variable not set tinfanide Excel Programming 2 06-10-2012 10:17 AM
excel where is procedure being called from davids67 Excel Programming 1 11-18-2011 06:48 AM
Can a function or sub be called using a variable name? What is this symbol called as? Franky Word 3 11-12-2011 08:16 AM
What is this right-click sub-menu called? wornways Word 3 08-13-2010 09:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft