본문 바로가기

IDL

일정한 시간간격으로 프로시저 실행하기

http://www.herbnoori.com/shop/orderend.html?ordernum=20100223162636plarina&paymethod=B&card_flag=N



Dim varNow As Variant

sub 프로세스1()

Sheets("샵송장입력csv").Cells(1, 1) = Now()

varNow = Now + TimeValue("00:00:02")

Application.OnTime varNow, "프로세스1"

End Sub


Sub 소리내기종료()
    On Error Resume Next
    Application.OnTime varNow, "프로세스1", Schedule:=False
End Sub



Sub ExportActiveWorksheet()
  Dim oldname$, oldpath$, oldformat
  Application.DisplayAlerts = False  'avoid safetey alert
  With ActiveWorkbook
    oldname = .Name
    oldpath = .Path
    oldformat = .FileFormat
    .ActiveSheet.SaveAs _
      Filename:="c:\file.csv", FileFormat:=xlCSV
    .SaveAs Filename:=oldpath + "\" + oldname, FileFormat:=oldformat
  End With
  Application.DisplayAlerts = True
End Sub