Displaying constants

A

Andy

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...
 
R

RobFMS

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

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top