ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   check if file is in particular folder (https://www.excelbanter.com/excel-programming/279953-check-if-file-particular-folder.html)

nikolaosk[_10_]

check if file is in particular folder
 
hi there,

i have a workbook and the user is asked to save the workbook under the
name "costs.xls"in a folder called "tests" in the current desktop.


how can i check using VBA that the user has saved the open workbook as
"costs.xls" and then check that he indeed saved it in the "tests"
folder on the desktop?


basically, how can i check that there is a folder "tests" on the
desktop with a file "costs.xls" in it ?


thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


J.E. McGimpsey

check if file is in particular folder
 
Check out the Dir() command in VBA Help.

In article ,
nikolaosk wrote:

i have a workbook and the user is asked to save the workbook under the
name "costs.xls"in a folder called "tests" in the current desktop.


how can i check using VBA that the user has saved the open workbook as
"costs.xls" and then check that he indeed saved it in the "tests"
folder on the desktop?


basically, how can i check that there is a folder "tests" on the
desktop with a file "costs.xls" in it ?


Bill Barclift

check if file is in particular folder
 
I f you haven't already done so, you might want to get familiar with
Microsofts Scripting Runtime Library, scrrun.dll. It contains, among other
things, an object called "FileSystemObject". This object has a method
called "FolderExists".

An alternative to the above is:

Public Function FolderExists(sDirectory) As Boolean
Dim sPathAttr As String

On Error GoTo Bail

FolderExists = False

sPathAttr = GetAttr(sDirectory) And 0

FolderExists = True

Bail:
End Function



Bill Barclift

"nikolaosk" wrote in message
...
hi there,

i have a workbook and the user is asked to save the workbook under the
name "costs.xls"in a folder called "tests" in the current desktop.


how can i check using VBA that the user has saved the open workbook as
"costs.xls" and then check that he indeed saved it in the "tests"
folder on the desktop?


basically, how can i check that there is a folder "tests" on the
desktop with a file "costs.xls" in it ?


thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:39 PM.

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