Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 如何将userform嵌入Excel工作表?_Vba_Excel - Fatal编程技术网

Vba 如何将userform嵌入Excel工作表?

Vba 如何将userform嵌入Excel工作表?,vba,excel,Vba,Excel,打开Excel电子表格时,我希望userform在工作表1的左上角打开。我不希望用户表单能够被移动或关闭。这可能吗?在用户表单代码窗格中尝试以下代码: 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

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

在用户表单代码窗格中尝试以下代码:

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

Userforms通常是位于Excel应用程序“上方”的模态或非模态窗口。如果您将表单控件(按钮、文本字段、组合框等)直接放在电子表格上,您所谈论的当然是可能的。这些控件将基本上停留在您放置它们的位置(需要注意的是,缩放级别和工作表滚动可能会影响它们的显示方式)。如果使用灰色阴影填充所有单元格,并使用相同的灰色阴影绘制单元格边界,则工作表将看起来像用户窗体背景。