乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>Excel</em> <em>VBA</em>中,新建了一个用户

<em>Excel</em> <em>VBA</em>中,新建了一个用户

作者:乔山办公网日期:

返回目录:excel表格制作


在Thisworkbook中,添加如下代码:
Application.Visible = False'将Excel文件隐藏

淼森数据.show'根据实际窗体名字更改

End Sub

不可以
亲 将窗体的showModal属性设置成FALSE 即可互不影响!

Sub 创建窗体()
Dim UsForm As Object

Set regex = CreateObject("vbscript.regexp")
regex.Global = True
regex.Pattern = "\d+"

pagename = Sheet1.[a2].Resize(Sheet1.[a65535].End(xlUp).Row, 1)
Set d = CreateObject("scripting.dictionary")
Set d1 = CreateObject("scripting.dictionary")
i = 1
For Each ke In pagename
If Len(ke) > 0 Then
d(pagename(i, 1)) = ""
d1(regex.Replace(ke, "")) = ""
End If
i = i + 1
Next
Set pagename = Nothing

Set UsForm = ThisWorkbook.VBProject.VBComponents.Add(vbext_ct_MSForm)'需引用Microsoft Forms 2.0 Object Library
With UsForm
.Properties("Caption") = Sheet1.[a1]
.Properties("Height") = 360
.Properties("Width") = 420
With .Designer
Set mympage = .Controls.Add("Forms.MultiPage.1")
With mympage
.Top = 2
.Height = UsForm.Properties("Height") - 50
.Width = UsForm.Properties("Width") - 20
.Left = 10
.BackColor = RGB(200, 200, 200)
End With

For Each ke1 In d1.keys
mympage.Pages.Add ke1 & "字头e799bee5baa6e4b893e5b19e338", ke1 & "字头"
i = 1
For Each ke2 In d.keys
If regex.Replace(ke2, "") = ke1 Then
Set objbtn = mympage.Pages(ke1 & "字头").Controls.Add("Forms.CommandButton.1")
With objbtn
.Top = 20 + 22 * (i - 1)
.Height = 20
.Width = 50
.Left = 18
.Caption = ke2
.BackColor = RGB(200, 200, 200)
End With
i = i + 1
End If
Next
Next
mympage.Pages.Remove ("Page1")
mympage.Pages.Remove ("Page2")
End With
End With
VBA.UserForms.Add(UsForm.Name).Show
ThisWorkbook.VBProject.VBComponents.Remove UsForm
Set UsForm = Nothing
Set regex = Nothing
Set objbtn = Nothing
End Sub

相关阅读

  • <em>excel</em> <em>vba</em>用<em&g

  • 乔山办公网excel表格制作
  • 假设所有zd需要显示的图片都但在F:图库文件夹中,Excel中有一表中输入了内这些文件名(不含扩展名),要求:点击工作容表中文件名就显示图片 1.插入image1控件 2.Alt+F11,将程序粘贴到本
关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网