Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default startup macro problem

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default startup macro problem

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
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
Excel Startup Problem aussievic Excel Discussion (Misc queries) 1 June 12th 06 04:33 PM
Need help with Excel Startup problem Sandy Excel Discussion (Misc queries) 6 April 13th 06 08:02 PM
Excel Startup Problem The Gallaghers Setting up and Configuration of Excel 0 March 14th 06 03:39 PM
Startup Problem Henrywaz Excel Discussion (Misc queries) 4 November 12th 05 06:16 AM


All times are GMT +1. The time now is 08:43 AM.

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"