Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Need your help.
I have an Excel workbook that does specific tasks automatically when it is started. I have been trying to add one more task but am having real problems doing so. What I want to do is to add code in my current workbook startup macro that will go to the C:\ drive and look for a specific file (e.g. targetfile.xls) at a specific location (e.g. C:\TARGET FOLDER\). If the file is found at that specific location all I want the macro to do is to put a value of "TRUE" on worksheet 1 in cell A1. If the macro does not find the file I want it to put a value of "FALSE" in cell A1. I don't want any alerts or messages telling me that the file could not be found, if that is the case. I think my problems in getting this to work thus far have been related to "error handling" issues if the file is not found. I can't seem to get the needed code right. Don't know if I am experiencing brain cell loss or am simply getting confused due to the noise from the Cicadas that have taken over my neighborhood. Any help getting me back on track will be greatly appreciated. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Scott,
You can use code like If Dir("C:\Target Folder\Target File.xls") = "" Then ' not found Range("A1").Value = False Else ' found Range("A1").Value = True End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "scott" wrote in message ... Need your help. I have an Excel workbook that does specific tasks automatically when it is started. I have been trying to add one more task but am having real problems doing so. What I want to do is to add code in my current workbook startup macro that will go to the C:\ drive and look for a specific file (e.g. targetfile.xls) at a specific location (e.g. C:\TARGET FOLDER\). If the file is found at that specific location all I want the macro to do is to put a value of "TRUE" on worksheet 1 in cell A1. If the macro does not find the file I want it to put a value of "FALSE" in cell A1. I don't want any alerts or messages telling me that the file could not be found, if that is the case. I think my problems in getting this to work thus far have been related to "error handling" issues if the file is not found. I can't seem to get the needed code right. Don't know if I am experiencing brain cell loss or am simply getting confused due to the noise from the Cicadas that have taken over my neighborhood. Any help getting me back on track will be greatly appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Startup Problem | Excel Discussion (Misc queries) | |||
Need help with Excel Startup problem | Excel Discussion (Misc queries) | |||
Excel Startup Problem | Setting up and Configuration of Excel | |||
Startup Problem | Excel Discussion (Misc queries) |