ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test for file existence (https://www.excelbanter.com/excel-programming/316613-test-file-existence.html)

Joseph[_46_]

Test for file existence
 

Hi Tom,

I just got a method 'saveas' of object 'workbook' failed. Any Ideas?

Cheer

--
Josep

-----------------------------------------------------------------------
Joseph's Profile: http://www.excelforum.com/member.php...nfo&userid=563
View this thread: http://www.excelforum.com/showthread.php?threadid=27773


Tom Ogilvy

Test for file existence
 
I changed P to C and created you structure. This revision worked fine for
me. (I changed C back to P).


Sub AAAA()

sName = "P:\clevedon staff\activities\" & _
Application.UserName & "\" & Application.UserName _
& " " & Format(Now, "DDMMYY") & " ActivityLog.csv"

If Dir(sName) < "" Then
Kill sName
End If
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
sName, FileFormat:=xlCSV, _
Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Saved = True
Application.Quit
Application.DisplayAlerts = True

End Sub

--
Regards,
Tom Ogilvy


"Joseph" wrote in message
...

Hi Tom,

I just got a method 'saveas' of object 'workbook' failed. Any Ideas?

Cheers


--
Joseph


------------------------------------------------------------------------
Joseph's Profile:

http://www.excelforum.com/member.php...fo&userid=5637
View this thread: http://www.excelforum.com/showthread...hreadid=277733





All times are GMT +1. The time now is 11:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com