+ Reply to Thread
Results 1 to 8 of 8

Close Excel File

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    Sunnyvale, Ca
    MS-Off Ver
    Excel 2003
    Posts
    7

    Close Excel File

    Hi All,

    I wrote this code to open an excel file when a button is pushed. I also have another piece of code to close the excel field when another button is pushed. The problem: the code to close the excel only works on my computer. There is no error message, but the file doesn't not close on others' computer. Can you please advise on a solution? thanks.

    Here is my code to close the file:


    Please Login or Register  to view this content.
    Please help.
    Last edited by tnguyen; 11-12-2009 at 09:27 PM. Reason: Solved

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Close Excel File

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then edit your post to add code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483

    Re: Close Excel File

    Hi!

    If you are purely after closing the workbook then I would probably just use
    Please Login or Register  to view this content.
    I think the reason why other people may not be able to close the workbook via your button is possibly because of Macro/Security Settings.
    Tools > Macro > Security > Ensure checkbox is at "low" for all other user's.

    Hope this helps...
    --
    Regards
    PD

    ----- Don't Forget -----

    1. Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks

    2. Thank those who have helped you by Clicking the scales above each post.

    3. Please mark your post [SOLVED] if it has been answered satisfactorily.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Close Excel File

    Ensure checkbox is at "low" for all other user's.
    That is an invitation to disaster and an ocean of hearbreak. Never, EVER set macro security to Low.

  5. #5
    Registered User
    Join Date
    11-10-2009
    Location
    Sunnyvale, Ca
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Close Excel File

    I did give that a try and it didn't change anything. So i set it back to medium. Any other suggestions?

  6. #6
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483

    Re: Close Excel File

    open attached workbook on other's pc and see if workbook closes when they click this button?

    if it does then code behind method will work, there's something wrong with either your workbook or the code you are currently using..

    let me know..
    Attached Files Attached Files

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Close Excel File

    I would say chances are you have Windows Explorer configured to hide extensions for known filetypes, and in so doing, you don't need to include the file extension in the workbook name. And the other computer isn't set up that way, and requires it.

    So include the extension (xls, xlsx, xslm, ... as appropriate), which works on systems configured either way:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-10-2009
    Location
    Sunnyvale, Ca
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Close Excel File

    Thanks Shg. Your code works perfectly!

+ 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