+ Reply to Thread
Results 1 to 2 of 2

close excel

Hybrid View

  1. #1
    anonymousA
    Guest

    close excel

    If you want to close all running instances of Excel, use code like

    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long,
    lParam As Any) As Long
    Private Const WM_CLOSE = &H10


    Private Sub CloseAllExcels()
    Dim XLHwnd As Long
    XLHwnd = FindWindow("XLMAIN", vbNullString)
    Do Until XLHwnd = 0
    SendMessage XLHwnd, WM_CLOSE, 0&, 0&
    XLHwnd = FindWindow("XLMAIN", vbNullString)
    Loop
    End Sub

  2. #2
    AA2e72E
    Guest

    RE: close excel


    A solution out of thin air!

    AND a copy of a response by another person, just a few days ago!!!!

+ 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