返回列表 上一主題 發帖

CreateObject("Wscript.shell").Popup 自動關閉功能失效??

Worksheet_Calculate 裡想暫停三分鐘??

Private Sub Worksheet_Calculate()
If Not IsError(Range("q2")) Then  
        If Range("Q2").Value > Range("R1").Value And Range("Q1").Value = 1 And flag = True Then
            CreateObject("Wscript.shell").Popup  Range("Q2").Value
            End If
       End sub
----------------------------------------------------
想在 CreateObject("Wscript.shell").Popup  Range("Q2").Value 之後
暫停3分鐘繼續執行,如何做?

TOP

本帖最後由 t8899 於 2013-7-20 09:36 編輯

我用
Application.Wait Now + TimeSerial(0, 3, 0)
會出現漏斗狀,無法做其他事情
這三分鐘裡,不要出現程式在跑(出現漏斗狀)

TOP

如果用
Application.OnTime Now + TimeValue("00:03:00")
是否不會有出現漏斗的狀況??
不知如何改呢?

TOP

我剛試了
停止三分鐘期間 IF 條件為何還是在跑??

TOP

CreateObject("Wscript.shell").Popup 自動關閉功能失效??

Private Sub Worksheet_Calculate()

         If Not IsError(Range("Q5")) Then
            If (Range("Q5").Value < Range("Q6").Value) And Range("S8").Value = 2 And flag = True Then
        CreateObject("Wscript.shell").Popup "xxxxxxx=>正在殺  " & Range("Q5").Value, 3, "Auto Closed MsgBox", 64
        Cells(1, 13).Interior.ColorIndex = 2
         ' flag = False
         Range("Q6").Value = Range("Q6").Value - Range("R4").Value
         Range("R6").Value = Range("R6").Value - Range("R4").Value
         flag = True
         Cells(1, 13).Interior.ColorIndex = 8
        
         End If
    End If
   
end sub

開檔選擇不更新(DDE) 測試一切正常
但選擇更新後,自動關閉功能不知為何會失效???

回復  t8899
網路抓下的
GBKEE 發表於 2013-7-22 11:57


我不會套用耶!

TOP

直接這樣套用,明天再測試
Dim ws As Object
    Set ws = CreateObject("wscript.shell")

TOP

我把
Dim ws As Object
Set ws = CreateObject("wscript.shell")
套進去, 設定1秒關閉,但它為何在15-30 秒之間才會關閉 ??

-----------------------------------------------------
Private Sub Worksheet_Calculate()
Dim ws As Object
Set ws = CreateObject("wscript.shell")
       If Not IsError(Range("Q5")) Then
            If (Range("Q5").Value < Range("Q6").Value) And Range("S8").Value = 2 And flag = True Then
       ws.Popup "xxxxxxx=>正在殺  " & (Range("Q5").Value), 1, "Auto Closed MsgBox"
                 Cells(1, 13).Interior.ColorIndex = 2
          ' flag = False
          Range("Q6").Value = Range("Q6").Value - Range("R4").Value
          Range("R6").Value = Range("R6").Value - Range("R4").Value
         flag = True
         Cells(1, 13).Interior.ColorIndex = 8
        
         End If
    End If
end sub

TOP

        靜思自在 : 有願放在心裡,沒有身體力行,正如耕田不播種,皆是空過因緣。
返回列表 上一主題