+ Reply to Thread
Results 1 to 2 of 2

Make excel flash in taskbar

Hybrid View

  1. #1
    Registered User
    Join Date
    03-08-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    1

    Make excel flash in taskbar

    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.

  2. #2
    Registered User
    Join Date
    06-04-2012
    Location
    pune
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Make excel flash in taskbar

    Perfect... I am looking same. I like it. *****

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1