我在我正在处理的excel文档中编写了一个VBA模块。我把所有东西都放在笔记本电脑上,最后发布给我的团队开始测试。
不幸的是,其中很多都遇到了以下错误:
隐藏模块中的编译错误:pushEmail。当代码与此应用程序的版本,平台或体系结构不兼容时,通常会发生此错误。
起初,我认为人们没有像我一样使用相同版本的Excel(Excel 2016),但事实证明他们都是。我尝试过的其他解决方案是:
我不确定还有什么可以尝试的,而且我已经通过Google的前30页试图找到解决方案,但无济于事。有人可以提出我可以尝试的解决方案吗?
提前谢谢。
更新 以下是有问题的代码:
Sub AcceptPush()
Dim track As Excel.Workbook
Dim push As Excel.Workbook
Dim trackFC As Excel.Workbook
Dim trackWks As Excel.Worksheet
Dim pushWks As Excel.Worksheet
Dim FCWks As Excel.Worksheet
Dim pName As String
Dim TLPass As Variant
Dim lastrow As Long
Dim rngFoundCell As Range
Set rng = Nothing
Dim MyCell As Range
Set push = Workbooks("Push Alert - Software.xlsm")
Set pushWks = push.Worksheets("Push")
Set rngFoundCell = pushWks.Range("R11:R53").Find(What:="y")
pName = pushWks.Range("D2").Value
TLPass = InputBox("Enter the TL Password")
Select Case TLPass
Case "password"
MsgBox "Password correct"
If rngFoundCell Is Nothing Then
MsgBox "You did not select a push to accept."
Else
Set track = Workbooks.Open(ThisWorkbook.Path & "\Account Pushing Tracker - Software.xlsm")
Set trackWks = track.Worksheets("Accounts")
Set trackFC = Workbooks.Open(ThisWorkbook.Path & "\Account Pushing Tracker - Team Tax.xlsm")
Set FCWks = trackFC.Worksheets("Accounts")
pushWks.Range("PushData[#All]").AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=push.Worksheets("Filter Criteria").Range("B6:Q7")
pushWks.Range("R:S").EntireColumn.Hidden = True
pushWks.Range("PushData").Copy
trackWks.Range("B" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlValues
pushWks.Range("PushData").Copy
FCWks.Range("B" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlValues
pushWks.Range("R:S").EntireColumn.Hidden = False
pushWks.Range("PushData").ClearContents
pushWks.ShowAllData
Range("A1").Select
Application.CutCopyMode = True
track.Close SaveChanges:=True
trackFC.Close SaveChanges:=True
End If
Case Else
MsgBox "INCORRECT! Your attempt has been recorded"
ActiveWorkbook.Worksheets("Log").Unprotect "123"
ActiveWorkbook.Worksheets("Log").Range("A" & Rows.Count).End(xlUp).Offset(1).Value = Application.UserName
ActiveWorkbook.Worksheets("Log").Range("B" & Rows.Count).End(xlUp).Offset(1).Value = Format(Now(), "dd/mm/yyyy hh:mm:ss")
ActiveWorkbook.Worksheets("Log").Protect "123"
End Select
End Sub
答案 0 :(得分:0)
当我尝试编译代码时,它会显示您尚未声明Rng
变量:
Set Rng = Nothing