Sunday
Jul152007
Check to see if file is open before opening: VBA Excel

Dim NewWB as workbook
Set NewWb = Workbooks(CStr(Month(Now) & " " & Day(Now) & " " & Year(Now)) & ".xls")
If NewWb Is Nothing Then
Set NewWb = Workbooks.Add
With NewWb
.Title = CStr(DateValue(Now))
.Subject = "MTB GL Statement"
.SaveAs Filename:=CStr(Month(Now) & " " & Day(Now) & " " & Year(Now)) & ".xls"
.SaveAs Filename:=Application.GetSaveAsFilename(fileFilter:="Excel Files (*.xls), *.xls")
End With
End If


Reader Comments