0
我有一個問題能夠在一個臨時工作簿中運行宏,這是故障線路:問題引用暫時未保存工作簿 - 運行時錯誤438
With ActiveSheet.QueryTables.Add(Connection:= _
"FilePath;", _
Destination:=temp.Range("$A$1"))
這段代碼顯示了運行時錯誤。我嘗試了其他技術,如readOnly,但他們也沒有工作。
有沒有解決這個問題的方法?
Sub temp()
Dim Qa As Workbook
Dim temp As Workbook
Dim sum As Worksheet
Dim cov As Worksheet
'Dim ClientDate1 As Date
'Dim ClientDate2 As Date
'Dim Url As String
'Dim FilePath As String
Set Qa = ThisWorkbook
Set temp = Workbooks.Add
Set sum = Qa.Worksheets("Summary")
Set cov = Qa.Worksheets("Coverage")
ClientName = sum.Range("A1")
ClientDate = sum.Range("A3").Value
ClientDate1 = Format(ClientDate, "mm")
ClientDate2 = Format(ClientDate, "yyyy")
Url = "http://" & "wiki.rosslyn.local/mediawiki/index.php/"
FilePath = Url & ClientName & "_" & ClientDate2 & "_" & ClientDate1
With ActiveSheet.QueryTables.Add(Connection:= _
"FilePath;", _
Destination:=temp.Range("$A$1"))
.Name = "Deloitte_2013_08"
.CommandType = 0
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
temp.Close
End Sub
這不是一塊代碼的正確:'隨着ActiveSheet.QueryTables.Add(連接:=文件路徑& "; 「,_',等等...... –
@KazJaw不會因爲某些原因而不起作用,它帶有運行時錯誤438. – Abi
地址保存在本地服務器上,任何想法如何讓它工作? @KazJaw – Abi