Re: How to copy an object in a array?
- From: "Richard Mueller [MVP]" <rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 08:04:18 -0600
Alain wrote:
I would like to keep a copy of an object in an array.
So, I do, for example:
set array(5) = my_file_object
but this code keeps a reference to this objet, not a copy of the object.
So, if a destroy my_file_object and if a do:
array(5).Delete
to delete my file, it don't work!
How can I keep a copy of my object to be able to do:
array(5).Delete
even if my_file_object is destroyed ?
Thanks a lot for your help.
Alain.
It works for me. For example:
===========
Option Explicit
Dim objFSO, arrFiles(2)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set arrFiles(0) = objFSO.GetFile("c:\Scripts\Test1.txt")
Set arrFiles(1) = objFSO.GetFile("c:\Scripts\Test2.txt")
Set arrFiles(2) = objFSO.GetFile("c:\Scripts\Test3.txt")
arrFiles(1).Delete
==========
When I ran this script, the file Test2.txt was deleted.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab web site - http://www.rlmueller.net
--
.
- References:
- How to copy an object in a array?
- From: Alain
- How to copy an object in a array?
- Prev by Date: Re: Add User to Local Administrators Group
- Next by Date: Re: Turn usernames into full names
- Previous by thread: How to copy an object in a array?
- Next by thread: Re: How to copy an object in a array?
- Index(es):