Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Missing ComboBox Combination

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wanna Learn - 07 Sep 2007 13:44 GMT
Hello  
I have a User form created is  VBA
I have a combo box  and it does not work   below  are all the codes for this
combobox

Private Sub ComboBox2_Change()
' enter value to unload combo box 2
ActiveDocument.FormFields("Text84").Result = ComboBox2.Value

Private Sub UserForm_Initialize()

 ComboBox1.ColumnCount = 1

 'Load data into ComboBox

 ComboBox1.List() = Array("offer", "renew")
 ComboBox2.List() = Array("New", "Expired", "Scheduled to Expire")
 ComboBox3.List() = Array("Pricing Specialist", "Senior Pricing Specialist")
End Sub

Private Sub CommandButton1_Click()
 With ActiveDocument
   .Bookmarks("Text71").Range _
   .InsertBefore TextBox1
   .Bookmarks("Text72").Range _
   .InsertBefore TextBox2
   .Bookmarks("Text84").Range _
   .InsertBefore ComboBox2
   .End With
   
    UserForm1.Hide

When I test the form and I get to the comboBox2 and I select an option I get
the error message
Run-Time error "5941':
The requested member of the collection does not exist.

when I click debug the following is highlighted  

Private Sub ComboBox2_Change()
' enter value to unload combo box 2
ActiveDocument.FormFields("Text84").Result = ComboBox2.Value

Please How do I correct this?  I have tried to no avail  thanks
Doug Robbins - Word MVP - 08 Sep 2007 01:55 GMT
It probably means that the bookmark Text84 does not exist in the document.

Also, in that you are using the command button to insert the data into the
document, why do you have the combobox change event?

I would be saving the data in document variables and having it displayed in
the document by the use of DOCVARIABLE fields.

Signature

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

> Hello
> I have a User form created is  VBA
[quoted text clipped - 43 lines]
>
> Please How do I correct this?  I have tried to no avail  thanks
Wanna Learn - 10 Sep 2007 15:04 GMT
Thanks Doug Robbins
This is very helpful...
I'm new at creating user forms . Can you tell how to save the data in
document variables and having it displayed in
> the document by the use of DOCVARIABLE fields?  or where I can get  information  on how to do it
thank you

> It probably means that the bookmark Text84 does not exist in the document.
>
[quoted text clipped - 51 lines]
> >
> > Please How do I correct this?  I have tried to no avail  thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.