KR
Tue Aug 15 08:26:06 CDT 2006
Try this small tweak:
Private Sub AutoOpen ()
UserForm_Initialize '<--add this line
End Sub
"Josie" <Josie@discussions.microsoft.com> wrote in message
news:9BFCC0A7-AB4A-42EF-9CEE-1F962D219EE0@microsoft.com...
> Hi Cindy,
>
> Many Thanks for your reply. You have put me on the right track however i
> still seem to be having problems....
>
> I shall explain...
>
> Since using your solution i opened my document and viewed the code for the
> combo box - i then clicked on:
>
> Insert - Proceedure
> Name - AutoOpen
> Type - Sub
> Scope - Private
>
> once this was complete i entered the following code:
>
> Private Sub AutoOpen ()
>
> End Sub
>
> Private Sub CommandButton1_Click()
> ComboBox1.DropDown
> End Sub
>
> Private Sub UserForm_Initialize()
> ComboBox1.AddItem"Item1"
> ComboBox1.AddItem"Item2"
> ComboBox1.AddItem"Item3"
> ComboBox1.AddItem"Item4"
>
> End Sub
>
> ---------
>
> Once i have put this information in and Run the form - save and close and
> reopen again, the drop down field Still only contains the first item and
the
> rest of the box is blank - i have to view code for combo box - run sub
user
> form again and then the fields are complete.
>
> Because this will need to be a secure document i really need for this to
> work first time when opened.... Sorry to sound dumb... I really appreciate
> your help.
>
> p.s - is there any way i could mail the form to you?
>
> Thanks again
>
>
>
> "Cindy M." wrote:
>
> > Hi =?Utf-8?B?Sm9zaWU=?=,
> >
> > > I have created a combo box in a document and have managed to populate
this
> > > with the options i want to drop down - The only problem is once i have
done
> > > this and save and close the document then reopen again - the options
disapeer
> > > from the combo box and i have to go back into the VBA and click on
"run sub
> > > user form" Then The options appear again.
> > >
> > > i really hope there is a way i can save this file whereby the sub user
form
> > > will automatically run (like macro) to fill the drop down box, but
stay with
> > > password protection as i dont want anyone else to modify the document
in any
> > > way.. I know of things like macro however it doesnt seem to give me
the
> > > option in VBA.
> > >
> > Put the code that fills the combobox into its own Sub. Name this sub
AutoOpen
> > and it will execute whenever the document is opened.
> >
> > Cindy Meister
> > INTER-Solutions, Switzerland
> >
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
> >
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 :-)
> >
> >