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 / March 2005

Tip: Looking for answers? Try searching our database.

combox problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phil - 17 Mar 2005 11:01 GMT
using the code below populates a combobox from a external table in a word
doc
my problem is when the user  types  in the combobox the code prevent other
text from being inserted.
Is there a way to overcome this problem
thanks phil

Private Sub cbroo_main_Change()
  cbroo_profile.Clear

   Set sourcedoc = Documents.Open("c:\schedule\Supplier\Roofing.doc")
   For i = 1 To sourcedoc.Tables(1).Cell(cbroo_main.ListIndex + 2,
2).Range.Paragraphs.Count
      Set myitem = sourcedoc.Tables(1).Cell(cbroo_main.ListIndex + 2,
2).Range.Paragraphs(i).Range
      myitem.End = myitem.End - 1
      cbroo_profile.AddItem myitem.Text
   Next i
   sourcedoc.Close SaveChanges:=wdDoNotSaveChanges
End Sub

Private Sub UserForm_Initialize()

  Dim sourcedoc As Document, i As Long, myitem As Range
   Set sourcedoc = Documents.Open("c:\schedule\Supplier\Roofing.doc")
   For i = 2 To sourcedoc.Tables(1).Rows.Count
      Set myitem = sourcedoc.Tables(1).Cell(i, 1).Range
      myitem.End = myitem.End - 1
      cbroo_main.AddItem myitem.Text

   Next i
End Sub
Cindy M  -WordMVP- - 27 Mar 2005 17:05 GMT
Hi Phil,

Your code isn't commented, and your problem description is a bit short. What
is the code in the _Change event supposed to be doing?

> using the code below populates a combobox from a external table in a word
> doc
[quoted text clipped - 29 lines]
>     Next i
> End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
Phil - 29 Mar 2005 03:39 GMT
hi Cindy
the code in the change event populates  combobox2 depending on what has been
selected from combox 1
the problem is that if you want to type your own information into either
combox you type a letter then the code opens the external file looking for
somthing begining with the letter you typed this happens every time you type
a letter is there a way to prevent this from happening

> Hi Phil,
>
[quoted text clipped - 43 lines]
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
Cindy M  -WordMVP- - 30 Mar 2005 09:51 GMT
Hi Phil,

> the code in the change event populates  combobox2 depending on what has been
> selected from combox 1
> the problem is that if you want to type your own information into either
> combox you type a letter then the code opens the external file looking for
> somthing begining with the letter you typed this happens every time you type
> a letter is there a way to prevent this from happening

Don't use the Change event, I'd say. What are you using the external file for?
Could you use the event that triggers when the user leaves the combobox
control?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
 
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.