Using an array with spaces

J

johnnykunst

Sub FillStateDD(
Dim myArray1() As Strin
Dim myArray2() As Strin
Dim myArray3() As Strin
Dim i As Lon
myArray1 = Split("AGU BCN BCS CAM CHP CHH"
myArray2 = Split("CHH COA COL DIF DUR"
myArray3 = Split("AL AK AS AZ AR CA CO CT DE DC FM FL GA GU")

ActiveDocument.FormFields("StateDD").DropDown.ListEntries.Clea
Select Case ActiveDocument.FormFields("CountryName").Resul
Case "Burgess Park Areas (a-m)
For i = 0 To UBound(myArray1
ActiveDocument.FormFields("StateDD").DropDown.ListEntries.Add myArray1(i
Next
Case "Mexico
For i = 0 To UBound(myArray2
ActiveDocument.FormFields("StateDD").DropDown.ListEntries.Add myArray2(i
Next
Case "USA
For i = 0 To UBound(myArray3
I'm using the following as a basis to populate a drop down in Word 2003 based on the previous entry in a drop down: ActiveDocument.FormFields("StateDD").DropDown.ListEntries.Add myArray3(i
Next
End Selec
End Su

The problem, is that rather than entering different words such as AGU or BCN, I want to use sentences; ie Burgess Park Area" and "Camberwell Green" but of course the space in between the two words makes each word sparate; how would I change the deliminter so that it's not the space, or should I be using something different to split?
 
D

Doug Robbins - Word MVP

You can use anything as the separator, as long as you define it. For
example:

MyArray1 = Split("Burgess Park Area,Camberwell Green,etc", ",")

MyArray1 = Split("Burgess Park Area|Camberwell Green|etc", "|")

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.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