ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If a file exists then do this... (https://www.excelbanter.com/excel-programming/359183-if-file-exists-then-do.html)

hshayh0rn

If a file exists then do this...
 
I need some help with code to do the following:

If a file like: BankNumber & "-Cost Centers.xls" exists in the directory
we're currently using THEN

useform.field_the_the_form.visible = False

BankNumber is defined as a string and is a dynamic part of the file name.

Also, where should this appear within my code? Should it be it's own module
or can it be right on the userform I'm munipulating the fields based on
whether or not the file exists?

hshayh0rn

If a file exists then do this...
 
I have to reivse this post... The value of Banknumber is not known at the
time I need the fields to be determined as visible or not. So.... the second
part of the file name is constant can we use a LIKE statement to determine if
the file exists instead?

"hshayh0rn" wrote:

I need some help with code to do the following:

If a file like: BankNumber & "-Cost Centers.xls" exists in the directory
we're currently using THEN

useform.field_the_the_form.visible = False

BankNumber is defined as a string and is a dynamic part of the file name.

Also, where should this appear within my code? Should it be it's own module
or can it be right on the userform I'm munipulating the fields based on
whether or not the file exists?



All times are GMT +1. The time now is 02:33 PM.

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