Constants as arrays?
Charlotte,
You could do something like this
Sub sonic()
Dim WordApp As Object, WordDoc As Object
Set WordApp = CreateObject("Word.Application")
mypath = "C:\"
MyArr = Array("Rules.doc", "Personal.doc", "Reporting.doc")
For x = LBound(MyArr) To UBound(MyArr)
WordApp.documents.Open mypath & MyArr(x)
WordApp.Visible = True
'do things
Next
End Sub
Mike
"Charlotte E" wrote:
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,
|