Can anyone help with the message: "Run-time error 5941: The requested member
of the collection does not exist."
The macro is as follows:

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("addresses included here")
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("phone numbers inserted here")

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

Re: Macro not working by Jezebel

Jezebel
Sun Sep 03 20:37:12 CDT 2006

It means that one of your formfield references is incorrect - most likely a
typo either in your code or when you named the formfield in the first place.
The debugger should be highlighting the faulty line.




"chris" <chris@discussions.microsoft.com> wrote in message
news:412786AC-5B89-4514-BEE6-637C48961F87@microsoft.com...
> Can anyone help with the message: "Run-time error 5941: The requested
> member
> of the collection does not exist."
> The macro is as follows:
>
> 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("addresses included here")
> 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("phone numbers inserted here")
>
> 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
>



Re: Macro not working by chris

chris
Sun Sep 03 21:00:02 CDT 2006

Thanks Jezebel. Evidently I'm a complete novice and am just learning the
true power of Word. It is highlighting the line:

Indx = ActiveDocument.FormFields("fName").DropDown.Value

I have titled the dropdown bookmark name as 'Name'. Is there somewhere else
I need to rename the form field?

Chris

"Jezebel" wrote:

> It means that one of your formfield references is incorrect - most likely a
> typo either in your code or when you named the formfield in the first place.
> The debugger should be highlighting the faulty line.
>
>
>
>
> "chris" <chris@discussions.microsoft.com> wrote in message
> news:412786AC-5B89-4514-BEE6-637C48961F87@microsoft.com...
> > Can anyone help with the message: "Run-time error 5941: The requested
> > member
> > of the collection does not exist."
> > The macro is as follows:
> >
> > 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("addresses included here")
> > 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("phone numbers inserted here")
> >
> > 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
> >
>
>
>

Re: Macro not working by Jay

Jay
Sun Sep 03 21:28:10 CDT 2006

The field name you supply within quotes in the code must match the
bookmark name in the Properties dialog of the field. Either change the
code to say FormFields("Name") or change the bookmark to fName.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sun, 3 Sep 2006 19:00:02 -0700, chris
<chris@discussions.microsoft.com> wrote:

>Thanks Jezebel. Evidently I'm a complete novice and am just learning the
>true power of Word. It is highlighting the line:
>
>Indx = ActiveDocument.FormFields("fName").DropDown.Value
>
>I have titled the dropdown bookmark name as 'Name'. Is there somewhere else
>I need to rename the form field?
>
>Chris
>
>"Jezebel" wrote:
>
>> It means that one of your formfield references is incorrect - most likely a
>> typo either in your code or when you named the formfield in the first place.
>> The debugger should be highlighting the faulty line.
>>
>>
>>
>>
>> "chris" <chris@discussions.microsoft.com> wrote in message
>> news:412786AC-5B89-4514-BEE6-637C48961F87@microsoft.com...
>> > Can anyone help with the message: "Run-time error 5941: The requested
>> > member
>> > of the collection does not exist."
>> > The macro is as follows:
>> >
>> > 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("addresses included here")
>> > 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("phone numbers inserted here")
>> >
>> > 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
>> >
>>
>>
>>