초단위 조작만 가능, 타이머 핸들러내에 타이머 재등록 함수를 호출하여 periodic timer를 구현 가능함.
단, 이 경우 등록된 타이머를 취소하는 방법에 유의. 기존에 등록된 타이머가 남아있으면 엑셀이 재 시작된다.

자세한 사용 예제 참조: http://www.cpearson.com/excel/OnTime.aspx
 

Application.OnTime Method

Schedules a procedure to be run at a specified time in the future (either at a specific time of day or after a specific amount of time has passed).

Syntax

expression.OnTime(EarliestTime, Procedure, LatestTime, Schedule)

expression A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

EarliestTime

Required

Variant

The time when you want this procedure to be run.

Procedure

Required

String

The name of the procedure to be run.

LatestTime

Optional

Variant

The latest time at which the procedure can be run. For example, if LatestTime is set to EarliestTime + 30 and Microsoft Excel is not in Ready, Copy, Cut, or Find mode at EarliestTime because another procedure is running, Microsoft Excel will wait 30 seconds for the first procedure to complete. If Microsoft Excel is not in Ready mode within 30 seconds, the procedure won’t be run. If this argument is omitted, Microsoft Excel will wait until the procedure can be run.

Schedule

Optional

Variant

True to schedule a new OnTime procedure. False to clear a previously set procedure. The default value is True.

Remarks

Use Now + TimeValue(time) to schedule something to be run when a specific amount of time (counting from now) has elapsed. Use TimeValue(time) to schedule something to be run a specific time.

Example

This example runs my_Procedure 15 seconds from now.

Visual Basic for Applications

Application.OnTime Now + TimeValue("00:00:15"), "my_Procedure"

This example runs my_Procedure at 5 P.M.

Visual Basic for Applications

Application.OnTime TimeValue("17:00:00"), "my_Procedure"

This example cancels the OnTime setting from the previous example.

 

Visual Basic for Applications

Application.OnTime EarliestTime:=TimeValue("17:00:00"), _
    Procedure:="my_Procedure", Schedule:=False

http://ezgoing.tistory.com/227

 

'Set up the next event one second from now
    NextTick = Now + TimeValue("00:00:01")
    Application.OnTime NextTick, "UpdateClock"

 

'Cancel the OnTime event(Stop the clock)
    On Error Resume Next
    Application.OnTime NextTick, "UpdateClock", , False

반응형

MS Excel: CDBL Function (VBA)

In Microsoft Excel, the CDBL function converts a value to a double.

Syntax

The syntax for the CDBL function is:

CDbl( expression )

expression is the value to convert to a double.

Applies To

  • Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Function

  • VBA function (VBA)

VBA Function Example

The CDBL function can only be used in VBA code. For example:

Dim LDouble As Double

LDouble = CDbl(8.45 * 0.005 * 0.01)

The variable called LDouble would now contain the value of 0.0004225.

반응형

'VBA' 카테고리의 다른 글

Excel VBA 이용해서 워드 파일 생성  (0) 2013.02.08
Application.OnTime 설명  (0) 2012.12.28
벽에 부딪힌 vba  (0) 2012.08.13
How to solve the problem - "Compile Error: Can't find project or library"  (0) 2012.05.21
집중력의 한계  (0) 2012.04.30
잘하지도 못하는데 요즘에는 괜시리 코딩 슬럼프에 빠져서 책도 안쳐다보고, 마냥 시간만 보내고 있다. 운동하고 늘 몸을 움직이며 꼼지락

iPhone 에서 작성된 글입니다.
반응형

'VBA' 카테고리의 다른 글

Application.OnTime 설명  (0) 2012.12.28
cdbl(Convert to a double)  (0) 2012.12.28
How to solve the problem - "Compile Error: Can't find project or library"  (0) 2012.05.21
집중력의 한계  (0) 2012.04.30
where to download ccrp timer  (0) 2012.04.25

Sometimes we can face the situation that wasn't expected and discovered that there is no problem except configuration.

 

 Todays I faced the louzy situation, you need to check below URL

 

http://www.idautomation.com/kb/vba-compile-error.html

Most likely, the application has lost the reference to an object or type library resulting in the above error when using Barcode Macros & Native VBA Functions. The problem may be resolved as follows:

  1. Open the database or application.
  2. Open a module in Design view or press ALT+F11 to switch to the Visual Basic Editor.
  3. On the Tools menu, click References.
  4. Clear the check box for the type library or object library marked as "Missing:"

An alternative to removing the reference is to restore the referenced file to the path specified in the References dialog box. If the referenced file is in a new location, clear the "Missing:" reference and create a new reference to the file in its new location.

Microsoft has documented this issue: VBA Functions Break in Database with Missing References

 

반응형

'VBA' 카테고리의 다른 글

cdbl(Convert to a double)  (0) 2012.12.28
벽에 부딪힌 vba  (0) 2012.08.13
집중력의 한계  (0) 2012.04.30
where to download ccrp timer  (0) 2012.04.25
요즘들어 vba 프로그래밍이 즐겁다  (0) 2012.04.22

 예전에는 집중력의 한계가 와도 억지로 붙들고 있었는데, 요즘에는 쿨하게 엑셀 프로그램을 짜보던가 드라마를 보던가 한다. 집중력이 떨어지는 상황에서 억지로 하다가 보니 본인도 한계를 느끼게 되고, 가끔은 짜증이 많이 나서 참지 못하는 경우도 겪어보기 때문이다.


 뭐 그렇다고 해서 목숨을 걸고 공부하는 것은 아니다. 예전에는 뭔가 그렇게 몰두를 했는데, 이제 35이 되고 나니까 예전처럼 뭐 하나에 올인했을때 벌어지는 사태에 대해서는 책임을 질만한 체력이 존재를 하지 않는다. 그나마 VBA는 많이 코딩하고 익숙해져서 그렇지, 다른 무언가를 만들라고 하면 난 기절해 버릴 것이다.


 이런 제길 이 시간에 이런 코딩 타이핑을 하면 안되는데. 내일 아침에는 오전내까지 만들어야만 하는 테스트 디자인이 있어서 일찍 출근해서 담당자랑 상의해야 하는데, 이게 뭐하는 것인지.

반응형

I've been studying excel vba and it needs ccrptmer.dll

That's the timer dll for VBA but it's very difficult for me to find the website for downloading the file

So I want to share this website with some people who would look for this file in the future.

http://ccrp.mvps.org/index.html?controls/ccrptimer6.htm

반응형

+ Recent posts