- 积分
- 256
- 明经币
- 个
- 注册时间
- 2004-10-21
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
在vb中利用下面代码可以实现利用一个textbox增加MsFlexGrid 的编辑功能(MsFlexGrid 可以设置为处于最底层),而在vba中却不可以(由于MsFlexGrid 总是处于最顶层),为什么?怎么改?
Public i As Integer Public j As Integer Private Sub MSFlexGrid1_Click() TextBox1.Visible = False End Sub
Private Sub MSFlexGrid1_DblClick() i = MSFlexGrid1.Col j = MSFlexGrid1.Row With MSFlexGrid1 TextBox1.Move .Left + .CellLeft, .top + .CellTop, .CellWidth, .CellHeight TextBox1.Text = .Text TextBox1.Visible = True TextBox1.SetFocus End With End Sub
Private Sub MSFlexGrid1_Scroll() TextBox1.Visible = False End Sub
Private Sub textbox1_LostFocus()
MSFlexGrid1.TextMatrix(j, i) = TextBox1.Text TextBox1.Visible = False End Sub
Private Sub UserForm_Initialize() TextBox1.Visible = False
MSFlexGrid1.Rows = 10 MSFlexGrid1.Cols = 2 MSFlexGrid1.FixedCols = 1 MSFlexGrid1.FixedRows = 0 MSFlexGrid1.ColWidth(0) = 1600 MSFlexGrid1.ColWidth(1) = 1500 MSFlexGrid1.Row = 0 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a1" MSFlexGrid1.Row = 1 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a2" MSFlexGrid1.Row = 2 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a3" MSFlexGrid1.Row = 3 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a4"
MSFlexGrid1.Row = 4 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a5" MSFlexGrid1.Row = 5 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a6" MSFlexGrid1.Row = 6 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a7" MSFlexGrid1.Row = 7 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a8" MSFlexGrid1.Row = 8 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a9" MSFlexGrid1.Row = 9 MSFlexGrid1.Col = 0 MSFlexGrid1.Text = "a10" End Sub |
|