如何将用户表单嵌入到Excel工作表中?

时间:2016-06-07 19:30:28

标签: excel vba excel-vba

当我的Excel电子表格打开时,我希望在表单1的左上角打开用户窗体。我不希望能够移动或关闭用户窗体。这可能吗?

1 个答案:

答案 0 :(得分:0)

在UserForm代码窗格中尝试此代码:

Private Sub UserForm_Initialize()
    Me.StartUpPosition = 3 'set starting position a the top-left of your window
End Sub

Private Sub UserForm_Layout()        
    With Me
        .Left = 0 ' set left position to the window left margin           
        .Top = 0  ' set top position to the window top margin
    End With    
End Sub