2011-10-03 305 views
1

我需要更改Excel组合框中的字体大小,因为默认字体太小。有没有办法做到这一点?在MS Excel中更改表单组合框中的字体大小

Combo in MS Excel sheet

这是我用我的宏代码:

Option Explicit 

Sub DropDown4_Change() 
    Dim comboValue As String 
    Dim Key1ColumnIndex As Integer 
    Dim Key2ColumnIndex As Integer 
    Dim Index As Integer 
    Dim comboName As String 
    Dim comboName2 As String 
    Dim comboID As Integer 

    'You can get the name by doing something like this in the immediate window: "? Sheet1.Shapes(1).OLEFormat.Object.Name" 

    For Index = 1 To ActiveSheet.Shapes.Count 
     comboName = ActiveSheet.Shapes(Index).OLEFormat.Object.Name 
     If InStr(comboName, "Drop") > 0 Then 
      'MsgBox InStr(comboName, "Drop") 
      comboName2 = comboName 
      comboID = Index 
     End If 
    Next 


    comboValue = ActiveSheet.Shapes(comboID).ControlFormat.List(ActiveSheet.Shapes(comboID).ControlFormat.ListIndex) 

    Select Case comboValue 

     Case "By Keyphrase" 
      Key1ColumnIndex = 18 
      Key2ColumnIndex = 19 
     Case "By Region" 
      Key1ColumnIndex = 19 
      Key2ColumnIndex = 18 
     Case "Default" 
      Key1ColumnIndex = 1 
      Key2ColumnIndex = 1 
    End Select 


    Range("DataValues").sort Key1:=Range("DataValues").Cells(1, Key1ColumnIndex), _ 
          Order1:=xlAscending, Header:=xlNo, DataOption1:=xlSortNormal, _ 
          Key2:=Range("DataValues").Cells(1, Key2ColumnIndex), order2:=xlAscending 
End Sub 

谢谢。

回答

2

它不能做

有没有格式化形式下拉的字体大小 - 甚至编程。如果这是一个绝对的要求,你必须把它切换到一个activeX控件。