Save as filename from clipboard

Mike100

New member
Joined
Sep 26, 2013
Messages
2
Reaction score
0
Points
0
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
 

bgoree09

New member
Joined
Aug 20, 2013
Messages
179
Reaction score
0
Points
0
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,
 

Mike100

New member
Joined
Sep 26, 2013
Messages
2
Reaction score
0
Points
0
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

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,
 

bgoree09

New member
Joined
Aug 20, 2013
Messages
179
Reaction score
0
Points
0
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.
 
Top