Macro - File Save As

  • Thread starter Thread starter tucopup
  • Start date Start date
T

tucopup

I made a button at the end of a form. The button should save th
workbook named for a unique identifier in a cell contained within th
workbook...MACRO HELP

If I could just record, it would be save as = to cell $b$14...but i
ain't that easy...is it
 
Save to a file name that's contained in B14?

Depending on what you put in that cell (path, folder, filename or some subset):

Option Explicit
Sub testme()

With ActiveWorkbook
.SaveAs Filename:="c:\my documents\excel\" & _
.Worksheets("sheet1").Range("b14").Value & ".xls", _
FileFormat:=xlNormal
End With

End Sub

(This doesn't have any error checking to see if the name is valid or if the
folder exists (or even if you're going to overwrite the file. You may want to
add some checks.)
 
Back
Top