Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
lkgoldie lkgoldie is offline
external usenet poster
 
Posts: 3
Default How do I populate my combobox - I know...it's been asked.

I have reviewed other posts that mirror my hicup but I just don't seem to be
getting it!

I am using the following (as a general example)

Private Sub UserForm_Initialize()
' set up the combo box list
With ComboBox1
.AddItem "Jan"
.AddItem "Feb"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "August"
.AddItem "Sept"
.AddItem "Oct"
.AddItem "Nov"
.AddItem "Dec"
.ListIndex = 0
End With
End Sub

All works fine till I save and reopen. Only Jan shows with the rest of the
list gone. From what I have got....I did lower my macro security to MED and
clicked the option of trust all...still have the problem.

I plan on using this script three times but w/ different information
(Months, Names and Locations). Is there a 'general' script line I can use to
make sure all of my combo box is saved and there when I reopen it?

Thanks
Lisa

  #2   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How do I populate my combobox - I know...it's been asked.

Is the combobox enabled?

When you say "save and reopen" do you mean use save, close and then use
FileNew and select the template containing the userform as the basis for
the new document?

--
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

"lkgoldie" wrote in message
...
I have reviewed other posts that mirror my hicup but I just don't seem to
be
getting it!

I am using the following (as a general example)

Private Sub UserForm_Initialize()
' set up the combo box list
With ComboBox1
.AddItem "Jan"
.AddItem "Feb"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "August"
.AddItem "Sept"
.AddItem "Oct"
.AddItem "Nov"
.AddItem "Dec"
.ListIndex = 0
End With
End Sub

All works fine till I save and reopen. Only Jan shows with the rest of the
list gone. From what I have got....I did lower my macro security to MED
and
clicked the option of trust all...still have the problem.

I plan on using this script three times but w/ different information
(Months, Names and Locations). Is there a 'general' script line I can use
to
make sure all of my combo box is saved and there when I reopen it?

Thanks
Lisa



  #3   Report Post  
Posted to microsoft.public.word.newusers
lkgoldie lkgoldie is offline
external usenet poster
 
Posts: 3
Default How do I populate my combobox - I know...it's been asked.

You truly are talking to a newbie.......How do I tell if the comboox is
enabled?

I save my document before closing (all information in my combobox is there)
when I return to open the document only the first item in my combo box is
there and the rest are gone. When I go to look at the script/code it is there
and I can run it again but I was looking for a way that when I reopen my
document after saving it that all information in my combo box stays. Thanks
for any help!

Lisa

"Doug Robbins - Word MVP" wrote:

Is the combobox enabled?

When you say "save and reopen" do you mean use save, close and then use
FileNew and select the template containing the userform as the basis for
the new document?

--
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

"lkgoldie" wrote in message
...
I have reviewed other posts that mirror my hicup but I just don't seem to
be
getting it!

I am using the following (as a general example)

Private Sub UserForm_Initialize()
' set up the combo box list
With ComboBox1
.AddItem "Jan"
.AddItem "Feb"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "August"
.AddItem "Sept"
.AddItem "Oct"
.AddItem "Nov"
.AddItem "Dec"
.ListIndex = 0
End With
End Sub

All works fine till I save and reopen. Only Jan shows with the rest of the
list gone. From what I have got....I did lower my macro security to MED
and
clicked the option of trust all...still have the problem.

I plan on using this script three times but w/ different information
(Months, Names and Locations). Is there a 'general' script line I can use
to
make sure all of my combo box is saved and there when I reopen it?

Thanks
Lisa




  #4   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How do I populate my combobox - I know...it's been asked.

If the Properties window is not displayed in the Visual Basic Editor, use
the View menu to display it. Then when you select the combobox on the
userform, its properties will be displayed in the Properties window. One of
those properties is the "Enabled" attribute of the control.

I still do not really understand how you are using this form. The form
should be in a template (.dot file) which should have an autonew macro in it
that calls the form. Then when you create a new document from the template,
that macro will run and cause the form to be displayed, which triggers the
Initialize event of the form to populate the combobox.

Actually, how do you know the rest are gone. Does nothing appear when you
use the down arrow on the combobox?

--
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

"lkgoldie" wrote in message
news
You truly are talking to a newbie.......How do I tell if the comboox is
enabled?

I save my document before closing (all information in my combobox is
there)
when I return to open the document only the first item in my combo box is
there and the rest are gone. When I go to look at the script/code it is
there
and I can run it again but I was looking for a way that when I reopen my
document after saving it that all information in my combo box stays.
Thanks
for any help!

Lisa

"Doug Robbins - Word MVP" wrote:

Is the combobox enabled?

When you say "save and reopen" do you mean use save, close and then use
FileNew and select the template containing the userform as the basis for
the new document?

--
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

"lkgoldie" wrote in message
...
I have reviewed other posts that mirror my hicup but I just don't seem
to
be
getting it!

I am using the following (as a general example)

Private Sub UserForm_Initialize()
' set up the combo box list
With ComboBox1
.AddItem "Jan"
.AddItem "Feb"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "August"
.AddItem "Sept"
.AddItem "Oct"
.AddItem "Nov"
.AddItem "Dec"
.ListIndex = 0
End With
End Sub

All works fine till I save and reopen. Only Jan shows with the rest of
the
list gone. From what I have got....I did lower my macro security to MED
and
clicked the option of trust all...still have the problem.

I plan on using this script three times but w/ different information
(Months, Names and Locations). Is there a 'general' script line I can
use
to
make sure all of my combo box is saved and there when I reopen it?

Thanks
Lisa






  #5   Report Post  
Posted to microsoft.public.word.newusers
lkgoldie lkgoldie is offline
external usenet poster
 
Posts: 3
Default How do I populate my combobox - I know...it's been asked.

Before I make things more confusing let me try to answer your questions...
I can tell the rest of my list is gone cause when I click on it nothing
appears.
The combobox is enabled and I did use a template (.dotfile). I still have
the same problem of my list items in my combo box not reappearing after I
save and reopen.
Now to make it confusing....I found an older thread with someone with a very
similar problem....you had replied with the following advise......
-------------------------------------------------------------------------------------------------

OK, there are a number of things he

1. If you put a combobox directly in a document, then code must be run to
populate it.

2. If the macro security level is set to high, the macros in the document
will be disabled without the user being aware of that fact (That is almost
certainly what is happening in your case)

3. If the macro security level is set to medium, the user will receive a
warning message when they open the document and they will have the option to
either enable or disable the macros in the document. If they disable the
macros, your combobox will not be populated; If they enable them, code such
as the following in the ThisDocument module can be used to populate the
combobox when they click on the drop button of the combobox

Private Sub ComboBox1_DropButtonClick()

Dim i as Long
For i = 1 to 10
ComboBox1.AddItem "Item" & i
Next i
End Sub

I would never put a combobox directly into a document because of this macro
security issue.

-----------------------------------------------------------------------------------------------
I copy and pasted the code above - saved it and reopened....sure enough the
list was there!
not sure what I am doing but I am sure the problem is with my limited
knowledge!

Thanks for taking the time to help us all on this thread.....in my searches
I see you are very popular!

Lisa



"Doug Robbins - Word MVP" wrote:

If the Properties window is not displayed in the Visual Basic Editor, use
the View menu to display it. Then when you select the combobox on the
userform, its properties will be displayed in the Properties window. One of
those properties is the "Enabled" attribute of the control.

I still do not really understand how you are using this form. The form
should be in a template (.dot file) which should have an autonew macro in it
that calls the form. Then when you create a new document from the template,
that macro will run and cause the form to be displayed, which triggers the
Initialize event of the form to populate the combobox.

Actually, how do you know the rest are gone. Does nothing appear when you
use the down arrow on the combobox?

--
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

"lkgoldie" wrote in message
news
You truly are talking to a newbie.......How do I tell if the comboox is
enabled?

I save my document before closing (all information in my combobox is
there)
when I return to open the document only the first item in my combo box is
there and the rest are gone. When I go to look at the script/code it is
there
and I can run it again but I was looking for a way that when I reopen my
document after saving it that all information in my combo box stays.
Thanks
for any help!

Lisa

"Doug Robbins - Word MVP" wrote:

Is the combobox enabled?

When you say "save and reopen" do you mean use save, close and then use
FileNew and select the template containing the userform as the basis for
the new document?

--
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

"lkgoldie" wrote in message
...
I have reviewed other posts that mirror my hicup but I just don't seem
to
be
getting it!

I am using the following (as a general example)

Private Sub UserForm_Initialize()
' set up the combo box list
With ComboBox1
.AddItem "Jan"
.AddItem "Feb"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "August"
.AddItem "Sept"
.AddItem "Oct"
.AddItem "Nov"
.AddItem "Dec"
.ListIndex = 0
End With
End Sub

All works fine till I save and reopen. Only Jan shows with the rest of
the
list gone. From what I have got....I did lower my macro security to MED
and
clicked the option of trust all...still have the problem.

I plan on using this script three times but w/ different information
(Months, Names and Locations). Is there a 'general' script line I can
use
to
make sure all of my combo box is saved and there when I reopen it?

Thanks
Lisa









  #6   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How do I populate my combobox - I know...it's been asked.

I think this gets back to the way in which you are calling the userform.

Usually, you can get away with

UserForm.Show

Purists inside on using the following method (in this case the userform has
been given the name of frmMemo)

Dim myForm As frmMemo

Set myForm = New frmMemo
myForm.Show vbModal
Unload myForm
Set myForm = Nothing

With this method, when the userform is closed, it is removed from memory by
the Set myForm = Nothing. As a result, the next time it is used, it has to
be initialized and that is when the items are added to the combobox.

With the simple userform.Show method, the userform is probably remaining in
memory and as a result is not be initialized again (though I must admit, if
it did remain in memory, I would expect the items still to be loaded into
the combobox.

So, you can either stick with what you have now (using the DropButtonClick
event) or try using the above method of calling the form, or another thing
that would probably cause the combobox items to be reloaded would be to put
the code that does that into the UserForm_Activate event.


--
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

"lkgoldie" wrote in message
...
Before I make things more confusing let me try to answer your questions...
I can tell the rest of my list is gone cause when I click on it nothing
appears.
The combobox is enabled and I did use a template (.dotfile). I still have
the same problem of my list items in my combo box not reappearing after I
save and reopen.
Now to make it confusing....I found an older thread with someone with a
very
similar problem....you had replied with the following advise......
-------------------------------------------------------------------------------------------------

OK, there are a number of things he

1. If you put a combobox directly in a document, then code must be run
to
populate it.

2. If the macro security level is set to high, the macros in the
document
will be disabled without the user being aware of that fact (That is almost
certainly what is happening in your case)

3. If the macro security level is set to medium, the user will receive
a
warning message when they open the document and they will have the option
to
either enable or disable the macros in the document. If they disable the
macros, your combobox will not be populated; If they enable them, code
such
as the following in the ThisDocument module can be used to populate the
combobox when they click on the drop button of the combobox

Private Sub ComboBox1_DropButtonClick()

Dim i as Long
For i = 1 to 10
ComboBox1.AddItem "Item" & i
Next i
End Sub

I would never put a combobox directly into a document because of this
macro
security issue.

-----------------------------------------------------------------------------------------------
I copy and pasted the code above - saved it and reopened....sure enough
the
list was there!
not sure what I am doing but I am sure the problem is with my limited
knowledge!

Thanks for taking the time to help us all on this thread.....in my
searches
I see you are very popular!

Lisa



"Doug Robbins - Word MVP" wrote:

If the Properties window is not displayed in the Visual Basic Editor, use
the View menu to display it. Then when you select the combobox on the
userform, its properties will be displayed in the Properties window. One
of
those properties is the "Enabled" attribute of the control.

I still do not really understand how you are using this form. The form
should be in a template (.dot file) which should have an autonew macro in
it
that calls the form. Then when you create a new document from the
template,
that macro will run and cause the form to be displayed, which triggers
the
Initialize event of the form to populate the combobox.

Actually, how do you know the rest are gone. Does nothing appear when
you
use the down arrow on the combobox?

--
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

"lkgoldie" wrote in message
news
You truly are talking to a newbie.......How do I tell if the comboox is
enabled?

I save my document before closing (all information in my combobox is
there)
when I return to open the document only the first item in my combo box
is
there and the rest are gone. When I go to look at the script/code it is
there
and I can run it again but I was looking for a way that when I reopen
my
document after saving it that all information in my combo box stays.
Thanks
for any help!

Lisa

"Doug Robbins - Word MVP" wrote:

Is the combobox enabled?

When you say "save and reopen" do you mean use save, close and then
use
FileNew and select the template containing the userform as the basis
for
the new document?

--
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

"lkgoldie" wrote in message
...
I have reviewed other posts that mirror my hicup but I just don't
seem
to
be
getting it!

I am using the following (as a general example)

Private Sub UserForm_Initialize()
' set up the combo box list
With ComboBox1
.AddItem "Jan"
.AddItem "Feb"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "August"
.AddItem "Sept"
.AddItem "Oct"
.AddItem "Nov"
.AddItem "Dec"
.ListIndex = 0
End With
End Sub

All works fine till I save and reopen. Only Jan shows with the rest
of
the
list gone. From what I have got....I did lower my macro security to
MED
and
clicked the option of trust all...still have the problem.

I plan on using this script three times but w/ different information
(Months, Names and Locations). Is there a 'general' script line I
can
use
to
make sure all of my combo box is saved and there when I reopen it?

Thanks
Lisa









Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ComboBox Help Kenny Microsoft Word Help 1 September 22nd 07 01:32 AM
Dropdown for Combobox jdyon Microsoft Word Help 9 August 11th 06 08:22 PM
ComboBox and UserForm_Initialize Scott Microsoft Word Help 5 April 29th 06 06:08 PM
How do I set up a combobox on word? omolano New Users 1 November 10th 05 05:27 AM
combobox Gman1959 Microsoft Word Help 1 January 27th 05 11:16 PM


All times are GMT +1. The time now is 02:54 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"