M
mooresk257
I have this code in the ThisWorkbook object:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Fname As Variant
Fname = Sheet1.Range("F3").Value & "-" & Sheet1.Range("F4").Value
Application.Dialogs(xlDialogSaveAs).Show Fname
End Sub
Where F3 & F4 are text values, i.e. the cells are formatted as text. The
cells contain a serial number and machine name, and so the file name is
concatenated as "0000-Machine Name.xls"
Sometimes on the file save event Excel (v2003) crashes. Most of the time it
doesn't. The code works like it is supposed to - but is there something
missing, or some error trapping I can add to prevent the crash?
Thanks!
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Fname As Variant
Fname = Sheet1.Range("F3").Value & "-" & Sheet1.Range("F4").Value
Application.Dialogs(xlDialogSaveAs).Show Fname
End Sub
Where F3 & F4 are text values, i.e. the cells are formatted as text. The
cells contain a serial number and machine name, and so the file name is
concatenated as "0000-Machine Name.xls"
Sometimes on the file save event Excel (v2003) crashes. Most of the time it
doesn't. The code works like it is supposed to - but is there something
missing, or some error trapping I can add to prevent the crash?
Thanks!