+ Reply to Thread
Results 1 to 3 of 3

Close workbook with use of filename?

  1. #1
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Close workbook with use of filename?

    Hi there,

    I currently use the following VBA code to find the most recent file within a folder, open it and copy the data to another sheet. I'm looking for a way to close it again afterwards.

    Please Login or Register  to view this content.
    Currently I am relying on the user by presenting them with a prompt box, I would like to avoid this altogether. Does anyone have any suggesstions?

    in addition I'm also wondering if it would be possible to enter the file name (actually part of the filename) returned with this code into a specific cell within the worksheet?

    Many thanks in advance.
    Last edited by Kramxel; 04-13-2012 at 08:55 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Close workbook with use of filename?

    Assign the workbook to an object when opening it. You can then use the object reference to close the workbook.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: Close workbook with use of filename?

    You Sir are nothing less than a legend!

    Thank you very much for the help.... (learning as i go and know just enough to get myself INTO trouble, just not OUT of 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