0
當我嘗試運行此VBA宏時說「編譯錯誤:無效或不合格的參考」。這裏是宏的相關部分:VBA「編譯錯誤:無效或不合格的參考」Application.FileDialog
帶有「Excel 2003」的第一個.Filters.Add突出顯示爲違規部分。
我甚至嘗試「上的錯誤繼續下一步:它並沒有幫助旁路錯誤,這讓我吃驚
Option Explicit
Sub DataProcessingExperiment7()
' Reduces CPU intensity + macro execution time since data types can be managed
Application.CalculationxlCalculationManual
On Error Resume Next
' Declare as strings, as integers, as variants, decDecimals, as Office.FileDialog
Dim strPath, strFileN, strDirN, strCPath, strRangeNOut, strRangeNIn, strTLCorn, strBRCorn, strtemp_name As String
Dim iStartcol, iStartrow, iColNo, iStep, iPlateNo, iRowIn As Integer
Dim vResMatrix() As Variant
Dim decBgrSum, decBgrVal, decVolcorr
Dim fd As Office.FileDialog
' MEeff = measure of efflux due to crudely purified HDL in scintillation
' Math operations are fastest with Integers/UIntegers: https://msdn.microsoft.com/en-us/library/ae55hdtk.aspx
' Start File Explorer to select file containing data
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim vrtSelectedItem As Variant
**.Filters**.Add "Excel 2003", "*.xls"
.Filters.Add "Excel 2003 Macro-Enabled", "*.xlsm"
.Filters.Add "All Files", "*."
With fd
If .Show = -1 Then
txtFileName = vrtSelectedItem
MsgBox "The path is: " & vrtSelectedItem
End If
' Excel 2003 is a good filter choice: Excel Viewer, OpenOffice, + Excel versions can open these files
' If .Show = - 1 user picked at least one file
Next vrtSelectedItem
Else
End If
End With
謝謝!修復它,現在到下一個錯誤(: –