Need to preserve a files last access and modified date/time using VB6

Hi all,

I need to be able to open word and excel docs from a VB6 app, but once finished with the docs, the last access and last modified dates/times need to be reset to what they were before they were opened by the application.

This used to be easy in DOS/Win16 days but everytime i attempt to retrieve a files last accessed date, the last accessed data is changed to the current time (as in the file has just been opened to retrieve the last accessed info, so the system updates the last accessed info on the file)

How on earth do you do it.  I'm using createfile etc without any luck.

The app will be used on 100's of word/excel docs so need to keep date/times.

nealgsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ComputronCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ComputronCommented:
0
nealgsAuthor Commented:
Hi Computron - thanks for the pointers, but already been there and tried them.

Didn't appear to work as last accessed date was still getting changed, but will try them again.

Gary
0
glass_cookieCommented:
Hi!

Wonder if this works (and hopefully it's not a duplicate of the above)...

Download...
http://www.vb-helper.com/HowTo/howto_set_file_times.zip
Description: Set a file's creation, last access, and last modified times

From what I know about windows explorer for windows 98, they set the last accessed date as the current system date whenever you view the file properties.  At least that was my old PC... FYI

That's it!

glass cookie =)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.