View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sandy Sandy is offline
external usenet poster
 
Posts: 270
Default Save workbook problem

ThisWorkbook.SaveCopyAs Filename:="C:\Folder\XXXXX-" & inputText &
".xls"

however if the file already exists I get an error "1004".

I presume I require something like

If 'ThisWorkbook exists' Then
'overwrite the existing file'
Else
ThisWorkbook.SaveCopyAs Filename:="C:\Folder\XXXXX-" & inputText &
".xls"
End If

Can anyone help with the required syntax for 'ThisWorkbook exists' and
'overwrite the existing file' - or if there is a better option.
Many thanks in advance.
Sandy