我需要将数据从csv文件导入到受UserInterFaceOnly保护的工作表。然而,它打破了"刷新backgroundQuery"导入失败。
这是我的代码
Dim wsName As String
wsName = Application.GetOpenFilename
Set Ws = ActiveWorkbook.Worksheets("data")
With Ws.QueryTables.Add(Connection:="TEXT;" & wsName, _
Destination:=ActiveWorkbook.Worksheets("data").Range("A1"))
.Name = "data"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlMacintosh
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.Refresh BackgroundQuery:=False
End With
实际上,我对"刷新backgroundquery"的功能感到困惑。这里。我不知道它会在这里做什么。如果有人能帮我解释并解决这个问题?