jkluio668
2/2/2018 - 7:21 AM

surveillance


sub watch1(i)
    If i Mod 100 = 0 Then debug.Print i
end sub




Private 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
Private Const MB_OKCANCEL = &O1
    
Private Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal _
    lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "USER32" (ByVal Hwnd As Long, _
    ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
    ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function BringWindowToTop Lib "USER32" (ByVal Hwnd As Long) As Long
        
Public wb As Workbook
        
Function bring_to_top(MyFile$)
    Dim name1 As Long
    name1 = FindWindow(vbNullString, MyFile)
    BringWindowToTop name1
    If MessageBox(0, "please check", "debugging", MB_OKCANCEL) = 2 Then End
End Function

sheet中:
            twb.Sheets("数据透视表").Activate
            twb.Sheets("数据透视表").[a3].Select
            bring_to_top (MyFile)
            If MessageBox(0, "please check", "debugging", MB_OKCANCEL) = 2 Then Exit Sub