Displaying constants

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible when creating a class to get VBA to display a list of
constants that can be used for parameter values when the class is used. For
example, the DoCmd.OpenForm method lists various constants for the View
parameter. Is it possible to do the same with my own classes and if so how?

Thanks in advance...
 
Create an enumeration (available in Access 2000 and higher)


For example...

CODE TO CALL CLASS MODULE
======================================================================
mobjExcel.SetCellFormatHorizontalTextAlignment_ByRange("aa", <param listing
displayed>)

Note: When the 2nd parameter is about to be set, the intell-sense gives you
a drop-down list of the entries to select.


CODE IN CLASS MODULE
======================================================================
Public Enum enumHorizontalAlignment
haAlignLeft = Excel.XlHAlign.xlHAlignLeft
haAlignRight = Excel.XlHAlign.xlHAlignRight
haCenter = Excel.XlHAlign.xlHAlignCenter
haCenterAcrossSelection = Excel.XlHAlign.xlHAlignCenterAcrossSelection
haDistributed = Excel.XlHAlign.xlHAlignDistributed
haFill = Excel.XlHAlign.xlHAlignFill
haGeneral = Excel.XlHAlign.xlHAlignGeneral
haJustify = Excel.XlHAlign.xlHAlignJustify
End Enum


Public Function GetCellFormatHorizontalTextAlignment_ByRange( _
ByVal Range As String) As enumHorizontalAlignment

:
: code removed
:

End Function

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Back
Top