+ Reply to Thread
Results 1 to 2 of 2

Closing a window using VBA

  1. #1
    Registered User
    Join Date
    08-24-2020
    Location
    london, england
    MS-Off Ver
    2018
    Posts
    2

    Closing a window using VBA

    Hi guys

    I wonder if anyone can help.
    I am trying to close a single excel window using the below code, however it doesn't seem to be doing anything. It works if I want to close say a notepad window, but not Excel.

    Alternatively, I could use "ActiveWindow.Close", if somehow it could find another instance of excel that is open.
    If excel has opened another program of excel, I cannot use "Windows("text work.csv").Activate" to find the workbook. If there is another way to activate it, then this could work?

    Thanks to anybody that can help me.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,887

    Re: Closing a window using VBA

    If you know the file path, you could use GetObject to get a reference to the workbook, then close that.
    Rory

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. closing form window with X - what happens
    By kmeld in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-23-2013, 05:44 AM
  2. Pop-Up Window Before Closing If ...
    By mjwillyone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2013, 01:37 PM
  3. Excel window not closing Auto_Open
    By dsava in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2012, 02:36 PM
  4. Closing macro window
    By DaveLearner in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-05-2010, 11:30 AM
  5. Pop up window when closing excel
    By pixiesoft in forum Excel General
    Replies: 3
    Last Post: 10-12-2009, 01:55 PM
  6. Closing Immediate window
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-20-2009, 11:43 AM
  7. Closing window issues
    By IamNutz in forum Excel General
    Replies: 1
    Last Post: 02-09-2007, 05:36 PM
  8. [SOLVED] Can I insert a pop up window in Excel to ask a ? b/4 closing?
    By Bernadette in forum Excel General
    Replies: 2
    Last Post: 05-09-2006, 11:10 AM

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