VBA Script for copy and paste to save

T

tamato43

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?
 
D

Dave Peterson

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
 
D

Dave Peterson

Sure:

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

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