TomTJ Posted May 20, 2008 Posted May 20, 2008 HelloI'm able to reproduce this example from MSDN to create a ComboxBox on Excel:http://msdn.microsoft.com/en-us/library/aa...office.11).aspxhttp://msdn.microsoft.com/en-us/library/aa...office.11).aspxDoes anyone have an idea to do this?ThxTom
TomTJ Posted May 21, 2008 Author Posted May 21, 2008 (edited) I founded how to do that combobox in H30 with datas from D5:D8. Here's a sample code: #include <ExcelCOM_UDF.au3> ;Enum XlDVType Const $xlValidateInputOnly = 0 Const $xlValidateWholeNumber = 1 Const $xlValidateDecimal = 2 Const $xlValidateList = 3 Const $xlValidateDate = 4 Const $xlValidateTime = 5 Const $xlValidateTextLength = 6 Const $xlValidateCustom = 7 ;Enum XlDVAlertStyle Const $xlValidAlertStop = 1 Const $xlValidAlertWarning = 2 Const $xlValidAlertInformation = 3 ;Enum XlFormatConditionOperator Const $xlBetween = 1 Const $xlNotBetween = 2 Const $xlEqual = 3 Const $xlNotEqual = 4 Const $xlGreater = 5 Const $xlLess = 6 Const $xlGreaterEqual = 7 Const $xlLessEqual = 8 Const $xlTrue = 1 Const $xlFalse = 0 $oExcel.Activesheet.Range("H30").Select() $oExcel.Activesheet.Range("H30").Validation.Add($xlValidateList,$xlValidAlertStop,$xlBetween,"=$D5:$D8");, AlertStyle:=xlValidAlertInformation, Minimum:="5", Maximum:="10" $oExcel.Activesheet.Range("H30").Validation.InputMessage = "" $oExcel.Activesheet.Range("H30").Validation.ErrorMessage = "" $oExcel.Activesheet.Range("H30").Validation.IgnoreBlank = $xlTrue $oExcel.Activesheet.Range("H30").Validation.InCellDropdown = $xlTrue $oExcel.Activesheet.Range("H30").Validation.ErrorTitle = "" $oExcel.Activesheet.Range("H30").Validation.InputTitle = "" $oExcel.Activesheet.Range("H30").Validation.ShowInput = $xlTrue $oExcel.Activesheet.Range("H30").Validation.ShowError = $xlTrue Edited May 21, 2008 by TomTJ
CHAFF Posted March 22, 2011 Posted March 22, 2011 $oExcel.Activesheet.Range("H30").Select()$oExcel.Activesheet.Range("H30").Validation.Add($xlValidateList,$xlValidAlertStop,$xlBetween,"=$D5:$D8");, AlertStyle:=xlValidAlertInformation, Minimum:="5", Maximum:="10" $oExcel.Activesheet.Range("H30").Validation.InputMessage = ""$oExcel.Activesheet.Range("H30").Validation.ErrorMessage = ""$oExcel.Activesheet.Range("H30").Validation.IgnoreBlank = $xlTrue $oExcel.Activesheet.Range("H30").Validation.InCellDropdown = $xlTrue $oExcel.Activesheet.Range("H30").Validation.ErrorTitle = ""$oExcel.Activesheet.Range("H30").Validation.InputTitle = ""$oExcel.Activesheet.Range("H30").Validation.ShowInput = $xlTrue $oExcel.Activesheet.Range("H30").Validation.ShowError = $xlTrueHey man great post.....I'm trying to go the other direction. Do you know of a way to retrieve all the enteries ComboBoxes/Dropdown Box?
CHAFF Posted March 24, 2011 Posted March 24, 2011 Hey man great post.....I'm trying to go the other direction. Do you know of a way to retrieve all the enteries ComboBoxes/Dropdown Box?Ok I sort of figured it out....so to get the formula and therefore the range in the Validation cell then you would use.MsgBox(0,"",$oExcel.ActiveSheet.Range("D3").Validation.Formula1)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now