![]() |
emulating xl consts
Hi, Is it easy to create custom xl consts that can be used as function
parameters? At the moment I'm using a standard module containing my initialised constants but I want the VB editor to prompt with a list of permissible parameter values as it does for inbuilt functions. (Ideally I would like something along the lines of: private sub myFunction(myParameter as myType) .... end sub Type myType myVariable1 as integer = 0 myVariable2 as integer = 1 end Type ) Any suggestions? Thanks in advance |
emulating xl consts
Hi,
Instead of Type , use Enum: Public Enum myEnum enumVar1 = 1 enumVar2 = 2 End Enum Sub test() Msgbox enumVar1 MsgBox myEnum.enumVar1 End Sub Regards, Sebastien "noel mc" wrote: Hi, Is it easy to create custom xl consts that can be used as function parameters? At the moment I'm using a standard module containing my initialised constants but I want the VB editor to prompt with a list of permissible parameter values as it does for inbuilt functions. (Ideally I would like something along the lines of: private sub myFunction(myParameter as myType) ... end sub Type myType myVariable1 as integer = 0 myVariable2 as integer = 1 end Type ) Any suggestions? Thanks in advance |
emulating xl consts
Fantastic. Thank you!
"sebastienm" wrote: Hi, Instead of Type , use Enum: Public Enum myEnum enumVar1 = 1 enumVar2 = 2 End Enum Sub test() Msgbox enumVar1 MsgBox myEnum.enumVar1 End Sub Regards, Sebastien "noel mc" wrote: Hi, Is it easy to create custom xl consts that can be used as function parameters? At the moment I'm using a standard module containing my initialised constants but I want the VB editor to prompt with a list of permissible parameter values as it does for inbuilt functions. (Ideally I would like something along the lines of: private sub myFunction(myParameter as myType) ... end sub Type myType myVariable1 as integer = 0 myVariable2 as integer = 1 end Type ) Any suggestions? Thanks in advance |
All times are GMT +1. The time now is 07:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com