Results 1 to 4 of 4

Thread: Save as filename from clipboard

  1. #1

    Save as filename from clipboard



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi - I work regularly with macros but can't seem to get the contents of a cell (copied to the clipboard in a macro) to be pasted in the "SAVE AS" file name block. The contents of the cell change via an hlookup formula and the result is the filename. At present this is done manually but I am sure there is a macro that will use the contents of the clipboard to be the filename. Regards Mike100

  2. #2
    Good morning,

    I'm self-taught on VBA, so I apologize if my word choice is a bit fuzzy, but...

    Basically you can dim the value you lookup as a string and then reference it (I'll call it Fname).

    The VBA code is very simple.

    Straight Save As is literally ::: ActiveWorkbook.SaveAs Fname

    Sometimes it is not preferable to save in the same location, so you can also call the excel saveas dialog box and choose a path:

    Application.Dialogs(xlDialogSaveAs).Show Fname

    Hope this helps and I apologize in advance for any terminology barriers,

  3. #3
    Hi
    Seems we're both self taught but you're ahead of me. I understand what you're saying but if the file name to be used to save the file is the text string in cell A1 (which can be named as Fname if necessary - cell A1 that is), what would be the macro script to save the file name as the text in cell A1. As we move through the database, the text in cell A1 changes and it would be ideal to have a keyboard macro to save the file .... if that makes sense.
    Mike100

    Quote Originally Posted by bgoree09 View Post
    Good morning,

    I'm self-taught on VBA, so I apologize if my word choice is a bit fuzzy, but...

    Basically you can dim the value you lookup as a string and then reference it (I'll call it Fname).

    The VBA code is very simple.

    Straight Save As is literally ::: ActiveWorkbook.SaveAs Fname

    Sometimes it is not preferable to save in the same location, so you can also call the excel saveas dialog box and choose a path:

    Application.Dialogs(xlDialogSaveAs).Show Fname

    Hope this helps and I apologize in advance for any terminology barriers,

  4. #4
    Even better. That's how I use it. See revised examples below:

    Straight SaveAs :: ActiveWorkbook.SaveAs Range("a1")

    Dialogbox Call :: Application.Dialogs(xlDialogSaveAs).Show Range("a1")

    As for the macro key. I've never done that before, but I think you "view macros" and in options you can establish a shortcut key.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •