excel - 除非应用程序关闭,否则链接文件不会关闭
问题描述
我有一个问题让我头疼了三天多,问题是我正在使用使用 vba 的数据输入应用程序,我已将其他一些 excel 工作簿链接到我的数据库条目,当我从我的应用程序的列表框:它们正常打开,但除非我关闭我的应用程序(并且所有 excel 工作簿都已关闭),否则它们不想关闭,如果有人可以帮助我,我将不胜感激。这是我的vba:
`Private Sub cmbfichedevie_Click()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Database")
Set shsearch = ThisWorkbook.Sheets("Searchdata")
Dim iRow As Long
Dim iRowsearchdat As Long
Dim ttt As Long
With shsearch
ttt = Selected_list + 1
iRowsearchdata = [Counta(Searchdata!A:A)]
If iRowsearchdata > 1 Then
If Selected_list >= iRowsearchdata Or Selected_list = 0 Then
MsgBox "Aucun élément n'est sélectionné.", vbOKOnly + vbInformation, "Ouvrir"
Else
If shsearch.Cells(ttt, 12) = "" Or shsearch.Cells(ttt, 12) = "No file" Then
MsgBox "Il n'y a aucune fiche de vie pour cet article.", vbOKOnly + vbInformation, "Ouvrir"
Else
'shsearch.Cells(ttt, 12).Hyperlinks(1).Follow
Workbooks.Open .Cells(ttt, 12)
'Unload Me
End If
End If
Exit Sub
Else
With sh
ttt = Selected_list + 1
iRow = [Counta(Database!A:A)]
If Selected_list >= iRow Or Selected_list = 0 Then
MsgBox "Aucun élément n'est sélectionné.", vbOKOnly + vbInformation, "Ouvrir"
Else
If sh.Cells(ttt, 12) = "" Or sh.Cells(ttt, 12) = "No file" Then
MsgBox "Il n'y a aucune fiche de vie pour cet article.", vbOKOnly + vbInformation, "Ouvrir"
Else
'sh.Cells(ttt, 12).Hyperlinks(1).Follow NewWindow:=True
Workbooks.Open .Cells(ttt, 12)
'Unload Me
End If
End If
End With
End If
End With
End Sub
`
解决方案
推荐阅读
- php - 为什么这会产生零误差除法?
- javascript - 显示最后一个空对象的添加新按钮
- node.js - Mongoose deep populate 没有返回本身有 ref 的填充文档
- matplotlib - Matplotlib:增加图形高度和绘图间距(是否有最大固定尺寸?)
- java - 发送带有标头 Content-Type:multipart/form-data 的 java POST 请求?
- php - Puppet Docker PHP Apache 设置 - 无效命令“RewriteRule”,可能拼写错误或已定义
- javascript - 在 Node js 中使用 Socket IO 来更新 pug 模板
- python - Keras 在加载 lambda 层时引发异常
- python - 如何在 gvim 的新命令行窗口中运行 python 文件
- firebase - Flutter 错误:引发了另一个异常:'DiagnosticsProperty 的实例
' . 重定向到该页面时显示空白屏幕