• paste into ‘save as’ dialog box (2000 / 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » paste into ‘save as’ dialog box (2000 / 2003)

    Author
    Topic
    #419469

    I want to name my workbook after the contents of a cell in sheet 1. When I copy and paste, it won’t accept the pasted text.
    I would use the method in a macro, but the macro recorder dos’nt help.
    Is there a way to paste into a dialog box, such as ‘save as’ using a macro or (simple) VBA?

    Viewing 0 reply threads
    Author
    Replies
    • #947210

      Could it be that the name in the cell is not valid? File and folder names can’t contain any of the following characters: / ? * : " | . Apart from that, you can use code like this:

      ActiveWorkbook.SaveAs Filename:=Worksheets(“Sheet1”).Range(“A3”)

      • #947362

        Thanks Hans, just the help I needed.
        The filename is, being of the form ‘2005 Workbook AB9876’ which works as a filename when saving by hand.

      • #947832

        Hello again. Sorry to not have thought ahead and asked this one at the same time. I need to save to a particular folder, in this case a shared folder on the server. How can I adapt the code to save to a named folder, which will always be the same, as well as pick up the filename from the range?

        Thanks in advance

        • #947834

          If Worksheets(“Sheet1”).Range(“A3″) contains just the filename you could just use something like:

          ActiveWorkbook.SaveAs Filename:=”C:myPath” & Worksheets(“Sheet1”).Range(“A3”)

          Or even read the path ffrom a variable or a cell.

          Steve

          • #947854

            You answered my question perfectly. I tried several options, but the ‘&’ between the path name and filename I would never have found on my own. Many thanks.

            • #947856

              The ampersand (&) is used to combine (concatenate) text strings in both VB and in excel (as well as many other programs)

              FYI, they symbol itself is a “stylized” combination of a script “Et” which is latin for “and” (some fonts actually look much more like and “E” and a “t”. (I am a wealth of useless knowledge… smile)

              Steve

    Viewing 0 reply threads
    Reply To: paste into ‘save as’ dialog box (2000 / 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: