ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Save As Macro (https://www.excelbanter.com/excel-discussion-misc-queries/150593-save-macro.html)

el zorro[_2_]

Save As Macro
 
Is it possible to create a macro to save an Excel file using the text stored
in a cell (A1 for example) as its filename. At this time cell A1 will
contain "LastName FirstName mmddyy". If possible, please help.


Gary''s Student

Save As Macro
 
Perhaps:

Sub store_A()
Dim s As String
s = "C:\Documents and Settings\Owner\My Documents\" & Range("A1").Value &
".xls"
ActiveWorkbook.SaveAs Filename:=s
End Sub


--
Gary''s Student - gsnu200734


"el zorro" wrote:

Is it possible to create a macro to save an Excel file using the text stored
in a cell (A1 for example) as its filename. At this time cell A1 will
contain "LastName FirstName mmddyy". If possible, please help.


Dave Peterson

Save As Macro
 
You'd need a macro that contained something like:

Option Explicit
Sub SaveMe()

with Thisworkbook
.saveas filename:=.worksheets("sheet999").range("x88").val ue & ".xls", _
fileformat:=xlworkbooknormal
end with

End Sub

There isn't any validation for the filename. You may want to add some checks.

el zorro wrote:

Is it possible to create a macro to save an Excel file using the text stored
in a cell (A1 for example) as its filename. At this time cell A1 will
contain "LastName FirstName mmddyy". If possible, please help.


--

Dave Peterson

el zorro[_2_]

Save As Macro
 
This worked great. Thanks much.

"Gary''s Student" wrote:

Perhaps:

Sub store_A()
Dim s As String
s = "C:\Documents and Settings\Owner\My Documents\" & Range("A1").Value &
".xls"
ActiveWorkbook.SaveAs Filename:=s
End Sub


--
Gary''s Student - gsnu200734


"el zorro" wrote:

Is it possible to create a macro to save an Excel file using the text stored
in a cell (A1 for example) as its filename. At this time cell A1 will
contain "LastName FirstName mmddyy". If possible, please help.



All times are GMT +1. The time now is 01:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com