how to check a file open and how to close it?

J

Joy

in our macro, some data will be written into a file.
but each time if the file is already opened, it has a run time error.

we want to check if a file is opened before writing data into it. if it
opens, we close it first then write data.
how to check if a file is open? how to close it??

thanks
 
J

Joy

sorry, i did not put it clearly.

acturally, it is not a ms file, it is a csv file, we read data from this
file and load data to ms project.

thanks!!
 
J

Joy

we have a some data in csv file, and we load data from csv file to ms
project.
we open it with excel

thanks
 
J

Jan De Messemaeker

Hi,

Then use set thisfileobject=getobject(,"theaddresss.csv")
I think it will only re-ope,n the file if it isn't open
But I never tried it with .csv :-((

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top