+ Reply to Thread
Results 1 to 9 of 9

Whats wrong with saving file like this?

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Whats wrong with saving file like this?

    I am trying to save the file since yesterday this way.

    Please Login or Register  to view this content.
    File saves well but doesnt open back. When I try to open the file It opens in vba editor but not the usual excel way.
    Last edited by Paul; 06-26-2012 at 11:26 PM. Reason: Added CODE tags for new user. Please do so yourself in the future.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Whats wrong with saving file like this?

    In Excel 2007+ it is good to include the file extension in the nFileName. Also, there is a VBA version of the TEXT function called FORMAT, you format a NOW to do the date and time all at once:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-06-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Whats wrong with saving file like this?

    All those things are working fine. The problem is that after i run my logic and save the macro using this. Its saving a file which i am not able to open with excel. But the file shows up in vba editor

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Whats wrong with saving file like this?

    Try this:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-06-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Whats wrong with saving file like this?

    The problem is taht after I save that file like that, I cannot open the file again. I has Data (I seen from Windows Properties). I closed Excel.exe from taskmanager and then tried to open the file. I shows empty excel window but when i go the VBA editor file is shown there

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Whats wrong with saving file like this?

    When you save the workbook it closes. The macro stops at that point & the variables are cleared from memory. The code needs to be in an add-in or personal workbook
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    06-06-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Whats wrong with saving file like this?

    Can you suggest a way around thi problem?

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Whats wrong with saving file like this?

    Run the macro from a different workbook.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Whats wrong with saving file like this?

    As I said in my post

    Quote Originally Posted by royUK View Post
    The code needs to be in an add-in or personal workbook
    Also, look at SaveCopyAs

+ 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