尊敬的专家,请在 RangetoHTML =替换功能中找到我面对编译错误:检测到模糊名称错误的下面代码。请帮我解决
class TimerControllerTests: XCTestCase {
var makeRepeatingTimerCallCount = 0
var lastMockTimer: MockTimer?
func testSomething() {
let sut = TimerController(seconds: 12, makeRepeatingTimer: { [unowned self] interval, closure in
self.makeRepeatingTimerCallCount += 1
self.lastMockTimer = MockTimer(interval: interval, closure: closure)
return self.lastMockTimer!
})
// call something on sut
// verify against makeRepeatingTimerCallCount and lastMockTimer
}
}
答案 0 :(得分:1)
正如Rick已经建议的那样......你可以试试这个
Function RangetoHTML(rng As Range)
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook
TempFile = Format(Now, "dd-mm-yy h-mm-ss") & ".htm"
Set x = ActiveWorkbook
Set TempWB = x
Set rng = Nothing
Set rng = ActiveSheet.UsedRange
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(2).Name, _
Source:=TempWB.Sheets(2).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
M = ts.readall
ts.Close
M = Replace(M, "align=center x:publishsource=", "align=left x:publishsource=")
''In Above code RangetoHTML for Replace I am facing the error.
RangetoHTML = M
Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function