Modifying arrays in a macro

K

Kiwi Pom

I have a Word (2002) form, widely distributed throughout an organisation.
The form has a number of combo boxes, each of which contains greater than 25
items. I have therefore set up a macro with an array for each combo box hard
coded with the combo box items.
These items may change several times during the year. I need a method to
change the array values WITHIN THE MACRO without going into the code, as
changes will be made by someone who knows nothing about VBA.
Any ideas along with sample code would be appreciated, as I am a VBA novice.
Many thanks
 
J

Jezebel

Put the source data into an external format that is easy to edit. Flat text
files and Excel spreadsheets are both easy to work with from VBA.

To read a text file into an array --

Dim pFilenum as long
Dim pData() as string
pFilenum = freefile
open "MyFile" for input as #pFilenum
pData = split(input(lof(pFilenum),pFilenum), vbcr)
close pFilenum
 
K

Kiwi Pom

Thanks,

I'll give it a try.

Jezebel said:
Put the source data into an external format that is easy to edit. Flat text
files and Excel spreadsheets are both easy to work with from VBA.

To read a text file into an array --

Dim pFilenum as long
Dim pData() as string
pFilenum = freefile
open "MyFile" for input as #pFilenum
pData = split(input(lof(pFilenum),pFilenum), vbcr)
close pFilenum
 

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