Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Initilizing the New DropDown feature

Having a little trouble initilizing the New DropDown1 that came up when I
inserted the ComboBox (Form Control). Here is the code used in ThisWokbook:

Private Sub Workbook_Open()
With DropDown1
.AddItem "Current Date"
.AddItem "Enter Date"
.Caption "Select Date Type"
End With
End Sub

It didn't like the (.AddItem "Current Date") and marked it in yellow for
debug. Can someone help me with the syntax?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Initilizing the New DropDown feature

A couple of things if it is a form control then the code is not applicable!
Set the format of the control as required

If you use an Active X Control
1. You need to explicitly reference the ComboBox location, e.g. code below
on Sheet1
2. There is no caption property for a ComboBox, if you are trying to set the
control to the first entry, use

..ListIndex = 0

Private Sub Workbook_Open()
With Worksheets("Sheet1").ComboBox1
.AddItem "Current Date"
.AddItem "Enter Date"
'.Caption "Select Date Type"
End With
End Sub

--

Regards,
Nigel




"Philosophaie" wrote in message
...
Having a little trouble initilizing the New DropDown1 that came up when I
inserted the ComboBox (Form Control). Here is the code used in
ThisWokbook:

Private Sub Workbook_Open()
With DropDown1
.AddItem "Current Date"
.AddItem "Enter Date"
.Caption "Select Date Type"
End With
End Sub

It didn't like the (.AddItem "Current Date") and marked it in yellow for
debug. Can someone help me with the syntax?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Initilizing the New DropDown feature


How do you initialize a DropDown Box I think that is the question here?

"Nigel" wrote:

A couple of things if it is a form control then the code is not applicable!
Set the format of the control as required

If you use an Active X Control
1. You need to explicitly reference the ComboBox location, e.g. code below
on Sheet1
2. There is no caption property for a ComboBox, if you are trying to set the
control to the first entry, use

..ListIndex = 0

Private Sub Workbook_Open()
With Worksheets("Sheet1").ComboBox1
.AddItem "Current Date"
.AddItem "Enter Date"
'.Caption "Select Date Type"
End With
End Sub

--

Regards,
Nigel




"Philosophaie" wrote in message
...
Having a little trouble initilizing the New DropDown1 that came up when I
inserted the ComboBox (Form Control). Here is the code used in
ThisWokbook:

Private Sub Workbook_Open()
With DropDown1
.AddItem "Current Date"
.AddItem "Enter Date"
.Caption "Select Date Type"
End With
End Sub

It didn't like the (.AddItem "Current Date") and marked it in yellow for
debug. Can someone help me with the syntax?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Initilizing the New DropDown feature

Got it to work with:

Private Sub Workbook_Open()
With ActiveSheet.Shapes("Drop Down 2").ControlFormat
.AddItem "Current Date"
.AddItem "Enter Date"
End With
End Sub

"Philosophaie" wrote:


How do you initialize a DropDown Box I think that is the question here?

"Nigel" wrote:

A couple of things if it is a form control then the code is not applicable!
Set the format of the control as required

If you use an Active X Control
1. You need to explicitly reference the ComboBox location, e.g. code below
on Sheet1
2. There is no caption property for a ComboBox, if you are trying to set the
control to the first entry, use

..ListIndex = 0

Private Sub Workbook_Open()
With Worksheets("Sheet1").ComboBox1
.AddItem "Current Date"
.AddItem "Enter Date"
'.Caption "Select Date Type"
End With
End Sub

--

Regards,
Nigel




"Philosophaie" wrote in message
...
Having a little trouble initilizing the New DropDown1 that came up when I
inserted the ComboBox (Form Control). Here is the code used in
ThisWokbook:

Private Sub Workbook_Open()
With DropDown1
.AddItem "Current Date"
.AddItem "Enter Date"
.Caption "Select Date Type"
End With
End Sub

It didn't like the (.AddItem "Current Date") and marked it in yellow for
debug. Can someone help me with the syntax?



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
select From dropdown and return another dropdown menu RE4379 Excel Discussion (Misc queries) 2 March 11th 10 03:09 PM
Dropdown box display only data dependent on another dropdown box? Chris Excel Worksheet Functions 8 August 5th 08 05:01 PM
Dropdown List within a dropdown Henn9660 Excel Worksheet Functions 1 April 10th 08 07:42 PM
populating a dropdown based on choice from a previous dropdown Conor[_3_] Excel Programming 2 March 9th 06 07:15 PM
offer dropdown options based on another dropdown Conor Excel Discussion (Misc queries) 2 January 13th 06 04:28 PM


All times are GMT +1. The time now is 12:16 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"