Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Losing Items in Forms.ComboBox Problem

I'm creating a forms combobox to place on a worksheet using the
following code, which also populates the combobox with an array.

----------------------
Public Sub CreateGraphFilterCombos(rng1 As Range, varComboName As
Variant, pt As PivotTable)
Dim combo1 As OLEObject, objWs As Worksheet, i As Integer, arrPf As
Variant, lineNum As Integer
Dim strTemp As Integer
Set objWs = rng1.Worksheet

'create Drop - down
With rng1
Set combo1 = objWs.OLEObjects.Add _
(ClassType:="Forms.Combobox.1", Link:=False, _
DisplayAsIcon:=False, Left:=.Left, _
Top:=.Top, Width:=.Width, Height:=.Height)
combo1.Placement = xlMoveAndSize
combo1.Height = combo1.Height + 3
End With
combo1.Name = "combo" & RemoveIllegalSQLChars(varComboName)

'get array to populate combo from varComboName column in database
arrPf = getUniqueColValuesDb(CStr(varComboName))

'populate combo with array
With combo1.Object 'gives us access to combo object
.AddItem "(All)"
For i = 1 To UBound(arrPf, 1)
.AddItem (arrPf(i, 1))
Next
.ListIndex = 0
.FontSize = 9
End With
End Sub
----------------------

This procedure works great. However I have an unusual problem. If I
close and then open the workbook, I lose all but the selected value in
the combobox. So if the combobox shows MfrA,MfrB,MfrC,MfrD when I
create it, and I select MfrC, all the other values disappear when I
reopen the workbook.

What am I missing here?

Thanks,
Wayne C.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Losing Items in Forms.ComboBox Problem

Maybe the Sub that populates the ComboBox should execute whenever the
file is opened (skip adding the Combobox when it's already there) and
store the prior selected value in a cell.

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Losing Items in Forms.ComboBox Problem

That's a possibility I've considered, but it seems to be a bit of a
kludgy workaround.

merjet wrote:
Maybe the Sub that populates the ComboBox should execute whenever the
file is opened (skip adding the Combobox when it's already there) and
store the prior selected value in a cell.

Hth,
Merjet


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combobox items determined by the selection in another combobox Alerion Excel Programming 2 September 13th 06 01:07 PM
formatting the list items for ComboBox created using Forms Desmond Excel Discussion (Misc queries) 3 May 4th 06 10:04 AM
Forms ComboBox cmpcwil2[_8_] Excel Programming 5 April 20th 06 04:44 PM
HELP : ComboBox (Forms), Activex or What ? MIKO Excel Programming 3 July 1st 04 11:03 PM
Combo Box Losing List Items InnerChild Excel Programming 1 June 24th 04 11:13 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"