excel - 用户表单组合框不会显示所有打开的 Excel 工作簿
问题描述
我正在尝试创建一个用户窗体,其中所有打开的 Excel 工作簿都显示在组合框中,但由于某种原因,尽管有几个工作簿清楚地打开,但组合框的下拉列表中没有显示结果。
这是用户窗体的代码
Option Explicit
Private Sub CommandButton1_Click()
MyFile = Me.SourceSlate.Value
Unload Me
End Sub
Private Sub CommandButton2_Click()
Hide
Stopped = True
Unload Me
End Sub
Private Sub SourceSlate_UserForm_Initialize()
Dim wkb As Workbook
Me.Label.Caption = "Select the Source slate from the list of open Excel Workbooks below"
With Me.SourceSlate
For Each wkb In Application.Workbooks
.AddItem wkb.Name
Next wkb
End With
End Sub
这是模块运行用户窗体的代码
Option Explicit
Public MyFile As String
Public Stopped As Boolean
Sub SourceSlate_UserForm()
Stopped = False
SourceSlate.Show
If Stopped Then Exit Sub
End Sub
任何帮助是极大的赞赏!!!
解决方案
推荐阅读
- python - Python Scraping:尝试根据用户输入抓取特定数据(电话详细信息)
- javascript - Webpack 开发服务器:如何将 localhost 端口重定向到不同端口的 URL
- python - 添加到(“cuda:0”)后PyTorch渐变不起作用
- protocols - 十六进制字符串产生半清晰的输出。如何找到其余部分的编码方式及其含义?
- angular - 使用 @Output 和 EventEmitter 在 Angular 中的两个组件之间进行通信
- swift - “找不到类”即使我之前在另一个视图控制器中做过,但它不起作用
- vba - 在 Mac 上使用 Excel VBA 进行 WebScraping
- javascript - 等待一个 redux 调度
- testing - 如何在 Ionic 中对相机组件进行单元测试
- c# - 如何将 id 参数传递给 .ashx 文件上传