VBA Script for copy and paste to save

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I think I may be asking for too much.

I tried Recording a Macro for Saving the content on Cell A1(which is where I
previously enterd a name), then go to "file", then "Save as" and then try to
Paste In the "File Name" Window.

It doesn't seem to work.

Does anyone know how to swing this one?
 
You could embed that value directly in the code--you don't need to copy|paste
into the dialog:

Something like:

ActiveWorkbook.SaveAs Filename:=ActiveSheet.Range("a1").Value & ".xls", _
FileFormat:=xlWorkbookNormal
 
Sure:

dim myFolder as string
myfolder = "C:\my documents\excel\"

ActiveWorkbook.SaveAs Filename:=myfolder & _
ActiveSheet.Range("a1").Value & ".xls", FileFormat:=xlWorkbookNormal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top