PC Review


Reply
Thread Tools Rate Thread

ComboBox.Value cannot be called in VBA?

 
 
Petr_R
Guest
Posts: n/a
 
      4th Nov 2008
Hi there,
I am using microsoft Excel 2003 Sp2. I have a problem after changing
Combobox list it remains there visible previous selected value even if it is
not actual anymore. It can be changed only by manually clicking and selecting
some new value. I found that there are 2 parameters in Combobox properties
(Text, Value) that changes this residual value, but when i am trying to
change it thru VB code (line is now commented) i get error 438 - object
doesn't support this method. So how can i change / delete the old value from
VB?

Thank you for help


private Sub UpdateInfo()

Set Data = Worksheets("Data")
Set Info = Worksheets("Info")
Dim cboTemp As OLEObject

Set cboTemp = Info.OLEObjects("SmlouvyC")
j = 0
With cboTemp
.Visible = True
.ListFillRange = ""
.LinkedCell = ""

.Visible = False
For i = 1 To 50

Data.Cells(j + 4, 1).Value = Data.Cells(KC, i + 7).Value
j = j + 1
If Data.Cells(KC, i + 7).Value = "" Then
GoTo LastRecord
End If
Next i
LastRecord:
.ListFillRange = "DATA!" + Range(Cells(4, 1), Cells(j + 2, 1)).Address
'.Value = ""
.Visible = True

End With


End Sub
 
Reply With Quote
 
 
 
 
dbKemp
Guest
Posts: n/a
 
      4th Nov 2008
On Nov 4, 12:14 pm, Petr_R <Pet...@discussions.microsoft.com> wrote:
> Hi there,
> I am using microsoft Excel 2003 Sp2. I have a problem after changing
> Combobox list it remains there visible previous selected value even if it is
> not actual anymore. It can be changed only by manually clicking and selecting
> some new value. I found that there are 2 parameters in Combobox properties
> (Text, Value) that changes this residual value, but when i am trying to
> change it thru VB code (line is now commented) i get error 438 - object
> doesn't support this method. So how can i change / delete the old value from
> VB?
>
> Thank you for help
>
> private Sub UpdateInfo()
>
> Set Data = Worksheets("Data")
> Set Info = Worksheets("Info")
> Dim cboTemp As OLEObject
>
> Set cboTemp = Info.OLEObjects("SmlouvyC")
> j = 0
> With cboTemp
> .Visible = True
> .ListFillRange = ""
> .LinkedCell = ""
>
> .Visible = False
> For i = 1 To 50
>
> Data.Cells(j + 4, 1).Value = Data.Cells(KC, i + 7).Value
> j = j + 1
> If Data.Cells(KC, i + 7).Value = "" Then
> GoTo LastRecord
> End If
> Next i
> LastRecord:
> .ListFillRange = "DATA!" + Range(Cells(4, 1), Cells(j + 2, 1)).Address
> '.Value = ""
> .Visible = True
>
> End With
>
> End Sub


Try:
Dim cboTemp As ComboBox
Set cboTemp = Info.OLEObjects("SmlouvyC").Object
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple sproc executes 240 times slower when called from asp.net thanwhen called from QA Radu Microsoft ASP .NET 6 27th Mar 2009 03:00 AM
Are sub-routines parameters called by reference or called by value? Thomas Lebrecht Microsoft VB .NET 2 25th Mar 2009 10:00 PM
Why is a button Click event also called when a textbox TextChanged event is called??? S_K Microsoft ASP .NET 6 8th Nov 2007 07:44 PM
Inheritance problem - Base Class method being called when Derived Class method should be called. Jeff Molby Microsoft VB .NET 3 6th Mar 2005 11:03 PM
Form's KeyDown delegate not called when in DropDownList ComboBox =?Utf-8?B?U2NvdHQ=?= Microsoft Dot NET Framework Forms 4 22nd Jun 2004 03:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:51 AM.