+ Reply to Thread
Results 1 to 3 of 3

Application.Dialogs(xlDialogSaveAs) = res ???

  1. #1
    Corey
    Guest

    Application.Dialogs(xlDialogSaveAs) = res ???

    res = InputBox("Enter a file name ? ", "Company Name here..")
    If res = "" Then Exit Sub
    ThisWorkbook.Save
    With ActiveWorkbook
    Worksheets(Array("A", "1")).Copy
    Application.Dialogs(xlDialogSaveAs) = res <========= Error here
    End With
    End Sub


    I get an error in the above.
    How do i set res to be the new file name ?

    Corey....






  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Corey,

    The SaveAs Dialog offered by Excel requires you manually enter the new file name. It can't be assigned by a variable. Other options would include the API SaveAs Dialog which does allow assignments through variables or by using the FSO (File System Object) script.

    Sincerely,
    Leith Ross

  3. #3
    Norman Jones
    Guest

    Re: Application.Dialogs(xlDialogSaveAs) = res ???

    Hi Corey,

    Try replacing:

    > Application.Dialogs(xlDialogSaveAs) = res


    with

    ActiveWorkbook.SaveAs Filename:=res & ".xls"


    ---
    Regards,
    Norman

    "Corey" <coreymcconnell@splicetech.com.au> wrote in message
    news:eJx74SnmGHA.4992@TK2MSFTNGP03.phx.gbl...
    > res = InputBox("Enter a file name ? ", "Company Name here..")
    > If res = "" Then Exit Sub
    > ThisWorkbook.Save
    > With ActiveWorkbook
    > Worksheets(Array("A", "1")).Copy
    > Application.Dialogs(xlDialogSaveAs) = res <========= Error here
    > End With
    > End Sub
    >
    >
    > I get an error in the above.
    > How do i set res to be the new file name ?
    >
    > Corey....
    >
    >
    >
    >
    >




+ 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