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 / January 2008

Tip: Looking for answers? Try searching our database.

Populate Combo Box with Style library

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
frank - 16 Jan 2008 20:23 GMT
Hello,

A simple question.  I have a userform with a combo box control.  I need the
combo box to be populated with a list of all of the styles available in the
current document (style library) when the dialog box opens (initializes).

Any help is greatly appreciated.

Thanks
Jay Freedman - 17 Jan 2008 02:48 GMT
>Hello,
>
[quoted text clipped - 5 lines]
>
>Thanks

You can modify this in a number of ways (suppress some of the names, etc.) but
this is how to start:

Private Sub UserForm_Initialize()
   Dim oStyl As Style
   For Each oStyl In ActiveDocument.Styles
       ComboBox1.AddItem oStyl.NameLocal
   Next oStyl
   ComboBox1.ListIndex = 0
End Sub

--
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.
frank - 17 Jan 2008 19:44 GMT
This is perfect.  Thank you so much!!

> >Hello,
> >
[quoted text clipped - 22 lines]
> Microsoft Word MVP        FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 
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.