Hi Guys,
I have four buttons on a workesheet 'Master' that do:
Save
Save and Print
Save, Print (increment cell S1 by 1, thereby changing the filename in B2 by 1)
Save and Close
The code structure (which I'm trying to get familiar with) seems not quite right as I get a 400 error on all macros.
The SavePrintNew code seems to be a problem. Even when I save fromt he normal menu, excel tries to save and comes back with a dialogue box saying 'document not saved'.
Any pointers would be gratefully welcomed.
Public Sub Save()
ThisFile = Range("B2").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
ThisWorkbook.Save
End Sub
Public Sub SavePrint()
ThisFile = Range("B2").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
ActiveWorkbook.Sheets("Master").PrintOut Copies:=1
End Sub
Public Sub SavePrintNew()
ThisFile = Range("B2").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
Dim i As Integer
For i = 1 To 20
Range("S1").Value = Range("S1").Value + 1
If Range("S1").Value >= 1 Then ActiveWorkbook.Sheets("Master").PrintOut Copies:=1
Next i
ThisFile = Range("B2").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub
Public Sub SaveClose()
ThisFile = Range("B2").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
Bookmarks