我在Excel电子表格中遇到DDE链接问题。它冻结了。我认为这可能是由旧的DDE链接引起的,我有这个脚本我试图关闭所有DDE链接。每当我运行它时,我会得到,
线:2 查尔:24 错误:预期的结束语句 代码:800A0401 来源:Microsoft VBScript编译错误
以下是代码:
Sub KillDDE()
Dim i, ChannelNumber As Integer
For i = 1 To 1000
Application.DDETerminate (i) ' Closes all DDE links whose channels might be open
Next i
ChannelNumber = Application.DDEInitiate("prortDDE", "DAX") 'initiates a new channel for a DDE link
Range("A2").Value = Application.DDERequest(ChannelNumber, "Last")
End Sub
答案 0 :(得分:0)
应该有所帮助的两件事:
Application.DDETerminateAll
方法found HERE Application.DDEInitiate
返回Long
所以Dim ChannelNumber As Long