+ Reply to Thread
Results 1 to 7 of 7

automatic name in 'save as dialog box' ok, but does not actually save the file?!

  1. #1
    Registered User
    Join Date
    12-01-2012
    Location
    Rotterdam, The netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    automatic name in 'save as dialog box' ok, but does not actually save the file?!

    Hello people,

    After searching long on these forums, I was able to create a macro which put a pre defined file name in the Save As dialog box, but after I hit the Save button, the file is not being saved.

    Can anybody help me with this? What is wrong with my code:

    Please Login or Register  to view this content.
    Thanks in advance,

    Marc.

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: automatic name in 'save as dialog box' ok, but does not actually save the file?!

    Try this:
    Please Login or Register  to view this content.
    Post responsibly. Search for excelforum.com

  3. #3
    Registered User
    Join Date
    12-01-2012
    Location
    Rotterdam, The netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: automatic name in 'save as dialog box' ok, but does not actually save the file?!

    Thanks Chippy,

    But that doesn't work. It hangs on "ActiveWorkbook.SaveAs FName". ("this extension cannot be used with selected filename...")

    I think it needs to incorporate something like "Application.Dialogs(xlDialogSaveAs).Show", but where and how...

    I got so far by reading here: http://www.mrexcel.com/forum/excel-q...-save-yet.html

    Here is my cleaned up code:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-01-2012
    Location
    Rotterdam, The netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: automatic name in 'save as dialog box' ok, but does not actually save the file?!

    To clarify, what does work is:
    - the Save As window opens
    - the text of cell d2 is displayed as name
    - the file format is set to .xlsx

    What is not working is:
    - After hitting the Save button the the Save As dialog box, the box disappears and I'm back in my sheet. But, the file has not been saved!

  5. #5
    Registered User
    Join Date
    12-01-2012
    Location
    Rotterdam, The netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: automatic name in 'save as dialog box' ok, but does not actually save the file?!

    I found another one and tried it:
    Please Login or Register  to view this content.
    I found out that the problem seems to be with the file format choosing (filefilter); when I use .xlsx, then it does not work. When I use .xls in the code then it does work.

    Also when I use .pdf instead of .xls, the file is beeing saved with the pdf extention, but it can not be opened because it is still a xls file.

    How do I set the macro so, that it saves it in de format of my choosing?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    If you want to save as PDF you need to use ExportAsFixedFormat.
    If posting code please use code tags, see here.

  7. #7
    Registered User
    Join Date
    12-01-2012
    Location
    Rotterdam, The netherlands
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: automatic name in 'save as dialog box' ok, but does not actually save the file?!

    Thanks Norie,

    Your comment put me on the right track. I was able to get everything working in my invoice program, with automatic numbering and saving a xlsx and pdf version, with overwrite alert.

    For anybody that is interested, here my complete code.

    Thanks!

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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