麻辣家族討論版版's Archiver

y54161212 發表於 2021-11-11 09:01

程式優化問題

附加檔案內的程式
是用來避免螢幕保護程式啟動
所以設定了兩個鍵
一個啟動 一個停止 寫在Module內
想請問是否可以改成 同一個程式 都使用COMMAND BUTTON來執行?


[attach]34368[/attach]

singo1232001 發表於 2021-12-9 16:43

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=117663&ptid=23475]1#[/url] [i]y54161212[/i] [/b]

自創一個

Private Sub StartStop_Timer()
If TimerActive = False Then

    TimerActive = True
    Timer
ElseIf TimerActive = True Then
    TimerActive = False
End If
   

End Sub

y54161212 發表於 2022-1-12 20:26

我來試試看
不能的話再跟大大請教

y54161212 發表於 2022-1-14 11:10

[quote]回復  y54161212

自創一個

Private Sub StartStop_Timer()
If TimerActive = False Then

    Ti ...
[size=2][color=#999999]singo1232001 發表於 2021-12-9 16:43[/color] [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=117968&ptid=23475][img]http://forum.twbts.com/images/common/back.gif[/img][/url][/size][/quote]


    我試著按照大大的指導測試了一下
    但程式並未啟動,請教我是哪邊用錯了?

Private Sub CommandButton1_Click()
Dim TimerActive As Boolean

If TimerActive = False Then

    TimerActive = True
    Call Timer
ElseIf TimerActive = True Then
    TimerActive = False
End If
   
End Sub


Private Sub Timer()

    If TimerActive Then
        Application.ScreenUpdating = False
        Application.SendKeys "{CAPSLOCK}"
        Worksheets("Sheet1").Range("A2").Value = Time
        Application.OnTime Now() + TimeValue("00:00:05"), "Timer"
        
    End If
   
End Sub

singo1232001 發表於 2022-1-25 04:17

[i=s] 本帖最後由 singo1232001 於 2022-1-25 04:30 編輯 [/i]

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118281&ptid=23475]4#[/url] [i]y54161212[/i] [/b]


    抱歉 姍姍來遲 不常上  已補上檔案

singo1232001 發表於 2022-1-26 11:10

[b]回復 [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=117663&ptid=23475]1#[/url] [i]y54161212[/i] [/b]


由於application.run 處於sheet1內

怕原po不了解呼叫其他程序的方法  順便把呼叫方式放上

呼叫程序是addadd   如圖片範例 檔案在上一樓

y54161212 發表於 2022-2-8 17:00

[quote]回復  y54161212


由於application.run 處於sheet1內

怕原po不了解呼叫其他程序的方法  順便把呼叫 ...
[size=2][color=#999999]singo1232001 發表於 2022-1-26 11:10[/color] [url=http://forum.twbts.com/redirect.php?goto=findpost&pid=118343&ptid=23475][img]http://forum.twbts.com/images/common/back.gif[/img][/url][/size][/quote]

萬分感謝
我再好好研究一番

頁: [1]

麻辣家族討論版版為 麻辣學園 網站成員  由 昱得資訊工作室 © Since 1993 所提供