macro: save w/ new name and print

A

as_sass

Hey,

I assigned a macro to a button in my worksheet on the basis of som
advice that I got in this forum (see macro below).
The macro saves the current workbook on c:\ and gives it a new filenam
with a date/time stamp.

However, I want the macro to do the following additional things now:

-Save the file in the current directory, without me specifying tha
path in the macro
-Also include first and lastname of user (contained in cell A1 and B1
in the filename.


Also, I want a second version of that macro which

-prints a specified sheet (called "output") while/after closing.

Any help that you can offer would be greatly appreciated. Cheers!

as


Sub Save()
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
ActiveWorkbook.SaveAs "C:\" & ThisWorkbook.name _
& " " & strdate & ".xls"
ActiveWorkbook.Close True
End Su
 
F

Frank Kabel

Hi
try:
Sub Save()
Dim strdate As String
Dim uname

With ActiveWorkbook.Worksheets("sheet1")
uname = .Range("A1").Value & " " & _
.Range("B1").Value
End With
strdate = Format(Now, "dd-mm-yy h-mm-ss")
ActiveWorkbook.SaveAs ThisWorkbook.Name _
& " " & strdate & " " & uname & ".xls"
'activeworkbook.workseehts("output").printout
ActiveWorkbook.Close True
End Sub
 
Top