为什么在运行以下宏时会打开“数据链路属性框”?

问题描述

下面的宏代码运行了几年没有错误,但现在打开“数据链接属性”窗口时打开文件夹中的文件,按照下面代码的最后一行。无论我们做什么,代码都会在下面的最后一行失败。任何文件中都没有数据链接或外部连接,现在所有文件似乎都会发生这种情况(甚至打开空白文件)。这个问题大约在两个月前发生在 Excel 更新后,但大约两周后消失,但现在又回来了。我对 VBA 代码相当擅长,但我没有任何解释,我在网上找到的任何东西也没有解释。

 Sub assetadjust()
        
    fiscalyearperiod = Application.InputBox("Type fiscal Year and period","FYxxPxx")
    
        Application.ScreenUpdating = False
        Application.displayStatusBar = False
        Application.Calculation = xlCalculationManual
        Application.EnableEvents = False
        Application.PrintCommunication = False
        Application.displayAlerts = False
        Application.AskToUpdateLinks = False
    
        Dim thiswb,valwb,wb As Workbook
    
        Set valwb = ActiveWorkbook
        Set thiswb = ThisWorkbook
        Dim ws,ws2 As Worksheet
    
    If thiswb.Name = valwb.Name Then
    
        Dim FSO As Object
        Dim sFolder As String
        Dim ToPath As String
        Dim FileExt As String
        Dim path As String,count As Integer
         
    alias = Environ("UserName")
    FY = Left(fiscalyearperiod,4)
    FP = Right(fiscalyearperiod,3)
    
    
    sFolder = "C:\Users\" & Environ("UserName") & "\Desktop\To Run"
        
        FileExt = "*.xls*"
        Set FSO = CreateObject("scripting.filesystemobject")
        Set fold = FSO.GetFolder(sFolder)
        
    a = 2
        
    For Each file In fold.Files
        Application.Workbooks.Open (sFolder & "\" & file.Name)

This is the window that appears and nothing we do gets us past this window without error

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)