rosspmm
06-29-2005, 06:39 AM
I have a report that is users need to complete on a quarterly basis - the report is in an excel workbook.
I have some VBA code assigned to a button to carry out some conditional formatting and to save the workbook to a central directory; all I now need is to be able to auto name the saved file using the contents of 2 cells that are always in the same place (C4 & C5) - the resulting file name needs to be "C4 + C5".xls
the code I am using to carry out the save is:
Sub SaveCopy()
Dim FName As Variant
FName = Application.GetSaveAsFilename
If FName <> False Then
If FName <> ActiveWorkbook.Name Then
On Error GoTo Error_SaveAs
ActiveWorkbook.SaveAs Filename:=FName
Else
ActiveWorkbook.Save
End If
End If
Exit Sub
Error_SaveAs:
MsgBox "error executing SaveAs with filename = " & FName & vbCrLf & _
"no save done", vbCritical
End Sub
I would also like to carry this out without the User seeing the dialogue box.
All help gratefully appreciated as I just cant figure it out :banghead:
I have some VBA code assigned to a button to carry out some conditional formatting and to save the workbook to a central directory; all I now need is to be able to auto name the saved file using the contents of 2 cells that are always in the same place (C4 & C5) - the resulting file name needs to be "C4 + C5".xls
the code I am using to carry out the save is:
Sub SaveCopy()
Dim FName As Variant
FName = Application.GetSaveAsFilename
If FName <> False Then
If FName <> ActiveWorkbook.Name Then
On Error GoTo Error_SaveAs
ActiveWorkbook.SaveAs Filename:=FName
Else
ActiveWorkbook.Save
End If
End If
Exit Sub
Error_SaveAs:
MsgBox "error executing SaveAs with filename = " & FName & vbCrLf & _
"no save done", vbCritical
End Sub
I would also like to carry this out without the User seeing the dialogue box.
All help gratefully appreciated as I just cant figure it out :banghead: