File save as cell value

T

Tony. D

I want to set up a Save As macro button to to save a file as "cell
value".xls. It should have the File Save As box appear with the follwing:

i.e. Cell A1 - MortgageNo
Cell A2 - 12345678

filename = MortgageNo12345678.xls

Can anyone help me out?
 
G

Gary''s Student

Sub Macro1()
v = Range("A1").Value & Range("A2").Value
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "\" & v
End Sub
 
D

Don Guillett

Sub Macro8()
v1 = Range("a1")
v2 = Range("a2")
ActiveWorkbook.SaveAs Filename:="C:\yourfolder\" & v1 & v2 & ".xls"
End Sub
 
T

Tony. D

When I copy the text inot my macro button as :

Private Sub CommandButton2_Click()
v = Range("A1").Value & Range("A2").Value
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "\" & v
End Sub

I get a runtime error 1004
 
C

Chris Premo

Tony. D said:
I want to set up a Save As macro button to to save a file as "cell
value".xls. It should have the File Save As box appear with the
follwing:

i.e. Cell A1 - MortgageNo
Cell A2 - 12345678

filename = MortgageNo12345678.xls

Can anyone help me out?

Create a "Blank" excel workbook with the following macro. This way the
"Blank" workbook will always be blank and ready to create a new Filled
in version. The Path will need to be change to meet your needs. You
could get sophisticated and work out how to get it to "Ask You Where
you want it to go".




Global strPath As String

Sub NameFile()

strPath = "I:\Database Development Files\BorderManager Filters"

ActiveWorkbook.SaveAs Filename:=strPath & "\" & Range("A1").Value &
" " & Range("A2").Value, _
FileFormat:=xlExcel8, CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Save


End Sub

--
 
D

Dave Peterson

What's the activeworkbook's path?

And you've double checked the values in A1 and A2, right?
 
C

Chris Premo

Some one posted this code and thought I'd incorporate it with the code
I gave you.

Sub NameFile()

Dim strngpth As String
strngpth = Application.InputBox("Enter the Desired Save path", , ,
, , , , 2)
Set strng1 = Application.InputBox(prompt:="Enter the Desired First
Cell", Type:=8)
Set strng2 = Application.InputBox(prompt:="Enter the Desired Second
Cell", Type:=8)

strPath = "I:\Database Development Files\BorderManager Filters\"

ActiveWorkbook.SaveAs Filename:=strngpth & strng1.Value & " " &
strng2.Value, FileFormat:=xlExcel8, CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Save

End Sub




--
 

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

Top