![]() |
|
#1
|
|||
|
|||
|
I have not done much coding for Word Docs, I have done some in MS Access and what i would like to do I know how to do in Access so I'm sure it can be done in word as well.. here is the deal:
I have about 20 combo boxes in a Word doc and I would like to be able to use a loop to set certain properties or update the text in them, I have them named in this sort of convention ComboBox1, ComboBox2... ComboBox20. I would imagine I should be able to do something like this as I can with Access but it doesn't quite work: Code:
crt =1
do while cnt <= 20
me("ComboBox" & ctr).value = "I am box #" & ctr
ctr= ctr + 1
loop
Last edited by Bird_FAT; 06-08-2009 at 11:31 PM. |
|
#2
|
||||
|
||||
|
Sorry - not found this in Access yet - any chance you could explain what
Code:
crt Code:
cnt Code:
ctr As they are obviously not doing the same in Word, it might help you get an answer if you explain what you want to do - not all of us use VBA in Access as much as we do in Word! One thing you might try is changing the loop from: Code:
do while cnt <= 20
me("ComboBox" & ctr).value = "I am box #" & ctr
ctr= ctr + 1
loop
Code:
While cnt <= 20
me("ComboBox" & ctr).value = "I am box #" & ctr
ctr= ctr + 1
Wend
Last edited by Bird_FAT; 06-09-2009 at 03:37 AM. |
|
#3
|
|||
|
|||
|
My appologies, I typed that too fast and called the variable two different things, it should have looked more like this:
Code:
dim ctr 'this will be the counter for the loop
crt =1
do while ctr <= 20
me("ComboBox" & ctr).value = "I am box #" & ctr
ctr= ctr + 1
loop
me.Combobox1.value where I can use a variable instead of the actual combobox name. Last edited by Bird_FAT; 06-09-2009 at 11:02 PM. |
|
#4
|
||||
|
||||
|
Have a go at:
Code:
dim ctr As Iterger
dim cbobx As String
Set ctr = 1
Set cbobx = "ComboBox" & ctr
do while ctr <= 20
me.cbobox.value = "I am box" & ctr
ctr= ctr + 1
loop
|
|
#5
|
|||
|
|||
|
Bird FAT,
I appreciate your reply.. I got the data member not found on the me.cbobox.value = "I am box" & ctr durring the compile. I ended up hard coding everything in for this project but I am still curious if there is something else I could have done.. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Hide a combo box
|
DrewB | Word | 3 | 06-08-2009 11:29 PM |
| Problem with Developer Form -- Check Boxes and Text Boxes | PCC | Word | 1 | 05-16-2009 05:22 AM |
| PP 2007: Template - Title slide boxes | netkos | PowerPoint | 0 | 02-19-2009 10:30 AM |
check boxes in outlook 2007
|
kim | Outlook | 3 | 02-17-2009 10:34 AM |
| Word Text Boxes do not print | RogerMantle | Word | 0 | 02-16-2009 06:48 AM |