I am trying to make excel flash in the taskbar when it is finished running a bunch of macros (download zip files, unzip, open files, copy and paste data and then format the data). I found the code below from http://www.vbforums.com/showthread.p...from-excel-VBA

Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FlashWindow Lib "user32.dll" _
    (ByVal hWnd As Long, ByVal bInvert As Long) As Long
Public Declare Sub Sleep Lib "kernel32.dll" _
    (ByVal dwMilliseconds As Long)
 
Sub FlashExcel()
    Dim hWnd As Long
    
    hWnd = GetExcelHandle
 
    'Flash Excel once
    FlashWindow hWnd, 1
    Sleep 500
    FlashWindow hWnd, 0
 
End Sub
 
Private Function GetExcelHandle() As Long
    ' Locate handle of window "Miscrosoft Excel - " & the active document name
    GetExcelHandle = FindWindow("XLMAIN", "Microsoft Excel - " & ActiveWorkbook.Name)
End Function
This works if I start a new session of excel and run just that macro alone, but as soon as I open another excel file in the same session (which is what my other macros do), it stops working and does not flash at the end. I am pretty sure that having multiple files open in the same session is the issue as I have tested other parts of the code separately.

I have changed the ActiveWorkbook.Name to my workbook name btw.

Is there any way around this?

Thanks.