Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lookup with multiple condition, but one condition to satisfy is en Eddy Stan Excel Worksheet Functions 2 October 27th 07 02:06 PM
Combine an OR condition with an AND condition Will Excel Discussion (Misc queries) 1 April 6th 07 03:52 PM
Condition 1 overules condition 2? Bultgren Excel Worksheet Functions 2 January 20th 06 12:29 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
I need 4 condition for condition formatting SeeKY Excel Programming 2 June 7th 05 09:41 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"