View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Charlotte E Charlotte E is offline
external usenet poster
 
Posts: 59
Default Constants as arrays?

Oh, yeah...

This is the way to do it - thanks, Peter :-)


Peter T wrote:
Const cDOCS As String = "Rules.doc\Personal.doc\Reporting.doc"

Sub test()
Dim v
For Each v In Split(cDOCS, "\")
MsgBox v, , "For Each"
Next

' or
Dim i As Long, arr
arr = Split(cDOCS, "\")
For i = 0 To UBound(arr)
MsgBox arr(i), , "For i ="
Next

End Sub

Regards,
Peter T

"Charlotte E" <@ wrote in message
...
Hello,


Is there a way to make Constants as Arrays?

Something like:

Public Const Doc(1) As String = "Rules.DOC"
Public Const Doc(2) As String = "Personal.DOC"
Public Const Doc(3) As String = "Reporting.DOC"

etc...


Currently I'm using:

Public Const Doc_01 As String = "Rules.DOC"
Public Const Doc_02 As String = "Personal.DOC"
Public Const Doc_03 As String = "Reporting.DOC"

...but that doesn't allow me to run through the documents in a loop,
like a For-To-Next.


Any suggentions?


TIA,