在 Excel 97 中运行 fileconv.xla 加载项时,ByRef 参数类型不匹配。
我需要这个工作的原因是因为我需要将 ~100 个 Lotus 1-2-3 文件从 wk* 转换为 xls。
我编译时在 VBA 中突出显示的术语在分隔代码中用双星号标记:
Workbooks.Open Filename:=PathFile(**p_FileInfo**(i, 3), p_FileInfo(i, 4)), ReadOnly:=True, Password:="password"
Sub FinishSub()
Dim TestOpen As Boolean
Dim DirDest As String
Application.ScreenUpdating = False
CreateDir "wzkfpbdxwzkfpbdxwzkfpbdx"
If Not (DirCreated) Then
Application.ScreenUpdating = True
Exit Sub
End If
If Len(dlg.DropDowns("DriveDD").List(dlg.DropDowns("DriveDD").ListIndex)) <> 2 Then
DirDest = Right(dlg.DropDowns("DriveDD").List(dlg.DropDowns("DriveDD").ListIndex), _
Len(dlg.DropDowns("DriveDD").List(dlg.DropDowns("DriveDD").ListIndex)) - 3) & _
Right(FullPath, Len(FullPath) - 2)
Else
DirDest = dlg.DropDowns("DriveDD").List(dlg.DropDowns("DriveDD").ListIndex) & _
Right(FullPath, Len(FullPath) - 2)
End If
Set wbResult = Workbooks.Add
ActiveCell.Value = LookupString("File")
Range("B1").Value = LookupString("ConvertedTo")
Range("C1").Value = LookupString("Result")
Range("D1").Value = LookupString("Reason")
Range("A2").Select
k = 0
For i = 1 To CountFile
p_FileInfo(i, 5) = DirDest
If p_FileInfo(i, 7) = "yes" Then
k = k + 1
On Error GoTo ErrorOpen
Success = "True"
ErrorMsg = ""
SetWaitCursor True
If TestIfWorkbookIsOpen(p_FileInfo(i, 4)) Then Workbooks(p_FileInfo(i, 4)).Close saveChanges:=False
Application.StatusBar = LookupString("Opening") & p_FileInfo(i, 4) & "(" & k & "/" & CountFileToConvert & ")"
Application.DisplayAlerts = False
Workbooks.Open Filename:=PathFile(**p_FileInfo**(i, 3), p_FileInfo(i, 4)), ReadOnly:=True, Password:="password"
On Error GoTo 0
On Error Resume Next
Application.StatusBar = LookupString("Saving") & p_FileInfo(i, 6) & "(" & k & "/" & CountFileToConvert & ")"
' Check if the XLS filename already exists.
FindFileName
Workbooks(p_FileInfo(i, 4)).SaveAs Filename:=PathFile(p_FileInfo(i, 5), p_FileInfo(i, 6)), FileFormat:=xlNormal
'Application.StatusBar = False
Workbooks(p_FileInfo(i, 4)).Close saveChanges:=False
Workbooks(p_FileInfo(i, 6)).Close saveChanges:=False
SaveIsSuccess Success
SetWaitCursor False
On Error GoTo 0
End If
Next i
SaveIsSuccess "End"
Application.StatusBar = False
Application.ScreenUpdating = True
Exit Sub
ErrorOpen: ' Error-handling routine.
Select Case Err ' Evaluate Error Number.
Case 18
TestMsgBox = MsgBox(LookupString("UserInterruption", "AlertTable"), vbYesNo)
If TestMsgBox = vbYes Then
On Error Resume Next
Application.StatusBar = False
Workbooks(p_FileInfo(i, 4)).Close saveChanges:=False
Workbooks(p_FileInfo(i, 6)).Close saveChanges:=False
Application.ScreenUpdating = True
Exit Sub
On Error GoTo 0
Else
Resume Next
End If
Case 1004
SetWaitCursor False
Set dlg = ThisWorkbook.DialogSheets("Password")
dlg.DialogFrame.Characters.Text = p_FileInfo(i, 4)
If TryAgain = False Then
dlg.TextBoxes("PassTB").Text = LookupString("IsProtected", "AlertTable")
dlg.EditBoxes("PassEB").Text = ""
Else
dlg.TextBoxes("PassTB").Text = LookupString("InvalidPassword", "AlertTable")
End If
ShowTest = dlg.Show
Select Case ShowTest
Case True
Resume
Case False
Success = "False"
ErrorMsg = Error()
Resume Next
End Select
SetWaitCursor True
End Select
Application.StatusBar = False
End Sub