Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Excel 2003 - Combobox.AddItem type mismatch

Hi there ,

I found the following code to add items to a combobox in a userform for
Excel 2002 , and works just fine in version 2002.

Private Sub UserForm_Initialize()
' Executed before the form is shown
Dim Row As Integer
Set HelpSheet = ThisWorkbook.Sheets(HelpSheetName)
TopicCount =
Application.WorksheetFunction.CountA(HelpSheet.Ran ge("A:A"))
For Row = 1 To TopicCount
ComboBoxTopics.AddItem HelpSheet.Cells(Row, 1)
Next Row
ComboBoxTopics.ListIndex = 0
CurrentTopic = 1
UpdateForm
End Sub

Now I've transferred this code (+ all other codes) and the userform to Excel
2003 and it gives an error message when adding items to the combobox.

Error message =
Run-time error '-2147352571 (80020005)
Type mismatch

When debugging the code stops at
ComboBoxTopics.AddItem HelpSheet.Cells(Row, 1)

Anyone have an idea where the error comes from ?
Thanks for helping out.
Mario


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Problem SOLVED : Excel 2003 - Combobox.AddItem type mismatch

Thanks , but I solved the problem

I've added a new variable StrCombItem
Use StrCombItem to store the value from == HelpSheet.Cells(Row, 1)
and changed the additem value
ComboBoxTopics.AddItem StrCombItem

This works for me.
Mario

"Mario" wrote in message
...
Hi there ,

I found the following code to add items to a combobox in a userform for
Excel 2002 , and works just fine in version 2002.

Private Sub UserForm_Initialize()
' Executed before the form is shown
Dim Row As Integer
Set HelpSheet = ThisWorkbook.Sheets(HelpSheetName)
TopicCount =
Application.WorksheetFunction.CountA(HelpSheet.Ran ge("A:A"))
For Row = 1 To TopicCount
ComboBoxTopics.AddItem HelpSheet.Cells(Row, 1)
Next Row
ComboBoxTopics.ListIndex = 0
CurrentTopic = 1
UpdateForm
End Sub

Now I've transferred this code (+ all other codes) and the userform to
Excel 2003 and it gives an error message when adding items to the
combobox.

Error message =
Run-time error '-2147352571 (80020005)
Type mismatch

When debugging the code stops at
ComboBoxTopics.AddItem HelpSheet.Cells(Row, 1)

Anyone have an idea where the error comes from ?
Thanks for helping out.
Mario




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
additem to combobox with an array jocke Excel Discussion (Misc queries) 2 September 29th 05 07:56 PM
combobox additem masterphilch Excel Programming 2 October 25th 04 11:04 PM
AddItem Method - Combobox value Todd Huttenstine Excel Programming 2 April 21st 04 05:13 PM
additem to a combobox from other excel worksheet gelu Excel Programming 1 March 1st 04 04:36 PM
Multiple Column ComboBox using Additem Jimmi Excel Programming 2 September 24th 03 02:40 AM


All times are GMT +1. The time now is 03:55 PM.

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"