+ Reply to Thread
Results 1 to 4 of 4

xlDialogSaveAs question

  1. #1
    KarenH
    Guest

    xlDialogSaveAs question

    I have an Excel spreadsheet with a macro in it to save. Clicking on the
    save brings up the "Save As" dialog, giving them the option to save it as
    various file types, such as Excel, CSV or TXT.

    I am using the following code to do this:

    fName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
    Application.Dialogs(xlDialogSaveAs).Show fName

    It works fine, but should the user save it to something other than Excel --
    say, a CSV format file -- then the active open workbook becomes what they
    saved it to. In other words, they open MyFile.xls, save it as MyFile.csv,
    and then the file they are working with is MyFile.csv, and I want them to
    still be working with Myfile.xls after they have saved it.

    I tried using "ApplicationDialogs(xlDialogSaveCopyAs).show fName, but that
    threw an error.

    Thanks in advance for any suggestions.


  2. #2
    Bob Phillips
    Guest

    Re: xlDialogSaveAs question

    xlDialogSaveCopyAs cannot be shown interactively, it errors.

    The following article has more info:

    http://support.microsoft.com/support.../q213/4/57.asp

    Q213457 - XL2000: Dialog Constants That Don't Have Interactive Dialog Box

    You could use Application.GetSaveAsFilename to obtain a file name from the
    user, and pass that to the SaveCopyAs method directly.




    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "KarenH" <[email protected]> wrote in message
    news:[email protected]...
    > I have an Excel spreadsheet with a macro in it to save. Clicking on the
    > save brings up the "Save As" dialog, giving them the option to save it as
    > various file types, such as Excel, CSV or TXT.
    >
    > I am using the following code to do this:
    >
    > fName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
    > Application.Dialogs(xlDialogSaveAs).Show fName
    >
    > It works fine, but should the user save it to something other than

    Excel --
    > say, a CSV format file -- then the active open workbook becomes what they
    > saved it to. In other words, they open MyFile.xls, save it as MyFile.csv,
    > and then the file they are working with is MyFile.csv, and I want them to
    > still be working with Myfile.xls after they have saved it.
    >
    > I tried using "ApplicationDialogs(xlDialogSaveCopyAs).show fName, but that
    > threw an error.
    >
    > Thanks in advance for any suggestions.
    >




  3. #3
    KarenH
    Guest

    Re: xlDialogSaveAs question

    Very helpful link, I didn't know that it wasn't interactive. Do you have any
    suggestions, then, as to how to allow the user to save a copy in whatever
    format they close through xldialogSaveAs, but without that one becoming the
    active workbook? So that they have saved it in their chosen format, but
    remain in the original XLS format?



    "Bob Phillips" wrote:

    > xlDialogSaveCopyAs cannot be shown interactively, it errors.
    >
    > The following article has more info:
    >
    > http://support.microsoft.com/support.../q213/4/57.asp
    >
    > Q213457 - XL2000: Dialog Constants That Don't Have Interactive Dialog Box
    >
    > You could use Application.GetSaveAsFilename to obtain a file name from the
    > user, and pass that to the SaveCopyAs method directly.
    >
    > --
    > HTH
    > Bob Phillips
    > (remove nothere from email address if mailing direct)
    >
    > "KarenH" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have an Excel spreadsheet with a macro in it to save. Clicking on the
    > > save brings up the "Save As" dialog, giving them the option to save it as
    > > various file types, such as Excel, CSV or TXT.
    > >
    > > I am using the following code to do this:
    > >
    > > fName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
    > > Application.Dialogs(xlDialogSaveAs).Show fName
    > >
    > > It works fine, but should the user save it to something other than

    > Excel --
    > > say, a CSV format file -- then the active open workbook becomes what they
    > > saved it to. In other words, they open MyFile.xls, save it as MyFile.csv,
    > > and then the file they are working with is MyFile.csv, and I want them to
    > > still be working with Myfile.xls after they have saved it.
    > >
    > > I tried using "ApplicationDialogs(xlDialogSaveCopyAs).show fName, but that
    > > threw an error.
    > >
    > > Thanks in advance for any suggestions.
    > >

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: xlDialogSaveAs question

    Yes, as I said last time ...


    You could use Application.GetSaveAsFilename to obtain a file name from the
    user, and pass that to the SaveCopyAs method directly

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "KarenH" <[email protected]> wrote in message
    news:[email protected]...
    > Very helpful link, I didn't know that it wasn't interactive. Do you have

    any
    > suggestions, then, as to how to allow the user to save a copy in whatever
    > format they close through xldialogSaveAs, but without that one becoming

    the
    > active workbook? So that they have saved it in their chosen format, but
    > remain in the original XLS format?
    >
    >
    >
    > "Bob Phillips" wrote:
    >
    > > xlDialogSaveCopyAs cannot be shown interactively, it errors.
    > >
    > > The following article has more info:
    > >
    > > http://support.microsoft.com/support.../q213/4/57.asp
    > >
    > > Q213457 - XL2000: Dialog Constants That Don't Have Interactive Dialog

    Box
    > >
    > > You could use Application.GetSaveAsFilename to obtain a file name from

    the
    > > user, and pass that to the SaveCopyAs method directly.
    > >
    > > --
    > > HTH
    > > Bob Phillips
    > > (remove nothere from email address if mailing direct)
    > >
    > > "KarenH" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I have an Excel spreadsheet with a macro in it to save. Clicking on

    the
    > > > save brings up the "Save As" dialog, giving them the option to save it

    as
    > > > various file types, such as Excel, CSV or TXT.
    > > >
    > > > I am using the following code to do this:
    > > >
    > > > fName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
    > > > Application.Dialogs(xlDialogSaveAs).Show fName
    > > >
    > > > It works fine, but should the user save it to something other than

    > > Excel --
    > > > say, a CSV format file -- then the active open workbook becomes what

    they
    > > > saved it to. In other words, they open MyFile.xls, save it as

    MyFile.csv,
    > > > and then the file they are working with is MyFile.csv, and I want them

    to
    > > > still be working with Myfile.xls after they have saved it.
    > > >
    > > > I tried using "ApplicationDialogs(xlDialogSaveCopyAs).show fName, but

    that
    > > > threw an error.
    > > >
    > > > Thanks in advance for any suggestions.
    > > >

    > >
    > >
    > >




+ 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