C
chris
I keep receiving the message "Run-time error 5941: The requested member of
the collection does not exist". I have created the following macro and the
line Indx = ActiveDocument.FormFields("fName").DropDown.Value is returning
the error. I am a complete novice but I have entered the drop down box in my
template and renamed the bookmark name to 'Name' as I think I'm required to.
The other form fields have been created . I have done the same with the
other Text form fields. Any assistance would be greatly appreciated.
Sub fNameExit()
Dim Name As Variant
Dim Address1 As Variant
Dim Address2 As Variant
Dim Phone As Variant
Dim Fax As Variant
Dim Indx As Long
Name = Array("Bundaberg Assessing Centre", "Cairs Assessing Centre", "Eight
Mile Plains", "Mackay Assessing Centre", "Maroochydore Assessing Centre",
"Rockhampton Assessing Centre", "Southport Assessing Centre", "Toowoomba
Assessing Centre", "Townsville Assessing Centre", "Zillmere Assessing Centre")
Address1 = Array("249 Bourbong Street", "Shop 50X, 537 Mulgrave Rd", "2649
Logan Road", "214 Victoria Street", "12-16 First Avenue", "Shop 22, Cnr
Richardson & Yaamga Rds", "239 Nerang Road", "176 James Street", "202 Ross
River Road", "E1A/605 Zillmere Road")
Address2 = Array("Bundaberg QLD 4670", "Earlville QLD 4870", "Eight Mile
Plains QLD 4740", "Mackay QLD 4740", "Maroochydore QLD 4558", "North
Rockhampton QLD 4700", "Southport QLD 4215", "Toowoomba QLD 4215",
"Aitkenvale QLD 4814", "Zillmere QLD 4034")
Phone = Array("(07) 4152 3377", "(07) 4033 6433", "(07) 3361 2890", "(07)
4957 2918", "(07) 5443 9422", "(07) 4928 7523", "(07) 5588 7719", "(07) 4632
2244", "(07) 4775 3999", "(07) 3862 9042")
Fax = Array("(07) 4151 4167", "(07) 4033 5672", "(07) 3841 6309", "(07) 4951
3831", "(07) 5479 3756", "(07) 4928 8458", "(07) 3841 6309", "(07) 4638
8819", "(07) 4775 4890", "(07) 3862 8803")
Indx = ActiveDocument.FormFields("fName").DropDown.Value
Indx = Indx - 1
ActiveDocument.FormFields("fAddress1").Result = Address1(Indx)
ActiveDocument.FormFields("fAddress2").Result = Address2(Indx)
ActiveDocument.FormFields("fPhone").Result = Phone(Indx)
ActiveDocument.FormFields("fFax").Result = Fax(Indx)
End Sub
the collection does not exist". I have created the following macro and the
line Indx = ActiveDocument.FormFields("fName").DropDown.Value is returning
the error. I am a complete novice but I have entered the drop down box in my
template and renamed the bookmark name to 'Name' as I think I'm required to.
The other form fields have been created . I have done the same with the
other Text form fields. Any assistance would be greatly appreciated.
Sub fNameExit()
Dim Name As Variant
Dim Address1 As Variant
Dim Address2 As Variant
Dim Phone As Variant
Dim Fax As Variant
Dim Indx As Long
Name = Array("Bundaberg Assessing Centre", "Cairs Assessing Centre", "Eight
Mile Plains", "Mackay Assessing Centre", "Maroochydore Assessing Centre",
"Rockhampton Assessing Centre", "Southport Assessing Centre", "Toowoomba
Assessing Centre", "Townsville Assessing Centre", "Zillmere Assessing Centre")
Address1 = Array("249 Bourbong Street", "Shop 50X, 537 Mulgrave Rd", "2649
Logan Road", "214 Victoria Street", "12-16 First Avenue", "Shop 22, Cnr
Richardson & Yaamga Rds", "239 Nerang Road", "176 James Street", "202 Ross
River Road", "E1A/605 Zillmere Road")
Address2 = Array("Bundaberg QLD 4670", "Earlville QLD 4870", "Eight Mile
Plains QLD 4740", "Mackay QLD 4740", "Maroochydore QLD 4558", "North
Rockhampton QLD 4700", "Southport QLD 4215", "Toowoomba QLD 4215",
"Aitkenvale QLD 4814", "Zillmere QLD 4034")
Phone = Array("(07) 4152 3377", "(07) 4033 6433", "(07) 3361 2890", "(07)
4957 2918", "(07) 5443 9422", "(07) 4928 7523", "(07) 5588 7719", "(07) 4632
2244", "(07) 4775 3999", "(07) 3862 9042")
Fax = Array("(07) 4151 4167", "(07) 4033 5672", "(07) 3841 6309", "(07) 4951
3831", "(07) 5479 3756", "(07) 4928 8458", "(07) 3841 6309", "(07) 4638
8819", "(07) 4775 4890", "(07) 3862 8803")
Indx = ActiveDocument.FormFields("fName").DropDown.Value
Indx = Indx - 1
ActiveDocument.FormFields("fAddress1").Result = Address1(Indx)
ActiveDocument.FormFields("fAddress2").Result = Address2(Indx)
ActiveDocument.FormFields("fPhone").Result = Phone(Indx)
ActiveDocument.FormFields("fFax").Result = Fax(Indx)
End Sub