, . , , , DoEvents Sleep ( API) , ? Sleep - API, .
DoEvents , , , I
(30% ). , , , DoEvents .
' 64 bit Excel
Public Declare PtrSafe Sub Sleep Lib "kernel32" ( _
ByVal dwMilliseconds As LongLong)
#Else
' 32 bit Excel
Public Declare Sub Sleep Lib "kernel32" ( _
ByVal dwMilliseconds As Long)
API
Sub SomeLongProcessWithDoEventsExample()
For i = 1 to 100000
'Some lengthy code
If i Mod 333 = 0 Then
DoEvents
End If
Next i
End Sub
Sub SomeLongProcessWithSleepExample()
For i = 1 to 100000
'Some lengthy code
If i Mod 333 = 0 Then
Sleep 1 * 1000 'Millseconds
End If
Next i
End Sub
Application.ScreenUpdating = False, , .
, . messsage - ,
( Environ $( "APPDATA" ) ):
Shell "explorer.exe" & " " & Environ$("APPDATA"), vbMaximizedFocus
PDF :
Shell Environ$("COMSPEC") & " /c Start C:\SomeFile.pdf", vbMaximizedFocus
, , API MessageBox, (hWnd), & H0 &; O0. VbSystemModal pop up. , excel , :
MessageBox &O0, "My Message", "My Caption", vbOKOnly + vbSystemModal
Public Declare PtrSafe Function MessageBox _
Lib "User32" Alias "MessageBoxA" _
(ByVal hWnd As LongLong, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal wType As LongLong) _
As Long
Public Declare Function MessageBox _
Lib "User32" Alias "MessageBoxA" _
(ByVal hWnd As Long, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal wType As Long) _
As Long