![]() |
How to check if the directory exists?
I try to save the file. I'd like to prevent the case when the path i
wrong - Temp directory doesn't exist - and show the warning by myself ex. ThisWorkbook.SaveAs C:\Temp\1.xl -- Message posted from http://www.ExcelForum.com |
How to check if the directory exists?
"ira " wrote in message ... I try to save the file. I'd like to prevent the case when the path is wrong - Temp directory doesn't exist - and show the warning by myself. ex. ThisWorkbook.SaveAs C:\Temp\1.xls --- Message posted from http://www.ExcelForum.com/ You can use to the filesystem object and the folderexists method Set fs = CreateObject("Scripting.FileSystemObject") If fs.FolderExists("C:\Temp") Then MsgBox "OK" Else MsgBox "not found" End If Set fs = Nothing Keith |
How to check if the directory exists?
Ira,
Use the DIR function Dir("C:\Temp", vbDirectory) it returns blank if the directory does not exist -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "ira " wrote in message ... I try to save the file. I'd like to prevent the case when the path is wrong - Temp directory doesn't exist - and show the warning by myself. ex. ThisWorkbook.SaveAs C:\Temp\1.xls --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 02:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com