![]() |
A condition and a variable
I want to use a command or two in a macro in Excel where it checks for the
existence of a file "ABCD" in folder C:\2009. If the file exists, then it should close the active file without saving. Otherwise if the file doesn't exist in continues the execution of the rest of the macro lines. Another question: How can I assign a text value in a variable? |
A condition and a variable
First question: This code will test if the file ABCD.xls exists in the
c:\2009 directory and, if it does, exit the subroutine right then and there... If Len(Dir("C\2009\ABCD.xls")) 0 Then Exit Sub Second question: I not exactly sure how to read what you want here. I mean, assignment to variables is kind of basic, for example... TextVariable = "I am some text" so I'm thinking maybe your question is not complete. Can you give us more detail and an example? Rick "Berj" wrote in message ... I want to use a command or two in a macro in Excel where it checks for the existence of a file "ABCD" in folder C:\2009. If the file exists, then it should close the active file without saving. Otherwise if the file doesn't exist in continues the execution of the rest of the macro lines. Another question: How can I assign a text value in a variable? |
All times are GMT +1. The time now is 05:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com