Function jg_open(str1)
jg_open = False
Dim w As Workbook
For Each w In Workbooks
If InStr(w.Name, str1) > 0 Then '查询是否开启的文件名
jg_open = True
Exit For
End If
Next w
End Function
'---------------------------------------------
Function open_1(Str1)
'判断是否已打开
'若打开就激活
'否则打开,打开指定路径下的对应的有该字符串的文件
' str1 = "实验动物"
If Not jg_open(Str1) = False Then
Set wb = GetObject(ThisWorkbook.Path & "\" & InArr1(Str1, get_data_arr("data_flname", 1), 1, 1))
' Set wb = GetObject(ThisWorkbook.Path & "\" & jg_open(str1))
Else
'先查找本文件夹内的,再查找数据库中的,即本文件夹内的优先被处理
fl1 = InArr1(Str1, get_files_to_arr(ThisWorkbook.Path), 1, 1)
If fl1 = "" Then fl1 = InArr1(Str1, get_data_arr("data_flname", 1), 1, 1)
Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & fl1)
End If
' a = get_files_to_arr("E:\zhangchuang\01_Woking\仪器-费用统计\201801-03仪器费用\团队")
' a = jg_open("instru")
' MsgBox a
End Function
Function jg_open(Str1)
jg_open = False
Dim w As Workbook
For Each w In Workbooks
If InStr(w.Name, Str1) > 0 Then '查询是否开启的文件名
' jg_open = True
jg_open = w.Name
Exit For
End If
Next w
End Function