代码盲, 太多了, 没怎么看懂 只是来问版主一个问题 在一个线程中一但做了excel的写操作后,再对excel某个格赋值就会挂掉 例: Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, ByVal lpParameter As Long, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Public Declare Function TerminateThread Lib "kernel32" (ByVal hThread As Long, ByVal dwExitCode As Long) As Long Public threadid1 As Long Private Sub Workbook_Open() Call CreateThread(Null, ByVal O&, AddressOf Module.init, VarPtr(0), ByVal 0&, threadid1) End Sub Public Sub init() Sheet1.writecell end sub 'sheet1 Option Explicit Public Sub writecell() Range("A1") = "test" End Sub Private Sub CommandButton1_Click() Dim l_ret As Long TerminateThread l_ret = TerminateThread(threadid1, 0&) Range("A1") = "do" End Sub
不知道怎么解决 2我要在可见性这个时机做一个处理, 怎么办? 我只想到了做一个线程来监听, 注意是可见这个时机啊, 不是OPEN 希望给解答一下 |