LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Error in a "Kill" command

Excel XP & Win XP
In this snippet of code I am trying to "Kill" 3 files. I get a "Subscript
out of range" error on the "Kill" command with the first file. So I changed
the order of the files in the "For Each.." line and again I get that error
with the first name. This tells me that the problem is with the "Kill"
line. The "ThePathDocs" is the path to the folder that holds the files.
What did I do wrong? Thanks for your time. Otto

For Each TheFile In Array("One.doc", "Two.doc", "Three.doc")
Workbooks(ThePathDocs & TheFile).ChangeFileAccess xlReadOnly
Kill Workbooks(ThePathDocs & TheFile).FullName


 
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
ie Command to Wait for "File Download" and "Save As" windows [email protected] Excel Programming 11 April 24th 08 11:20 AM
XLL and "New Form" command error nicgendron[_3_] Excel Programming 0 August 15th 05 01:57 PM
FileCopy Command Giving "Subscript Out of Range" Error Message Jim Hagan Excel Programming 2 June 15th 05 06:07 PM
Exel2000 VBA - Creating a Command Bar - Error: "Object Variable or With not Set" keepitcool Excel Programming 0 August 11th 03 12:29 PM


All times are GMT +1. The time now is 05:26 AM.

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

About Us

"It's about Microsoft Excel"