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

Posted on 2006-03-25
Medium Priority
Last Modified: 2008-01-09
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.

Question by:nealgs
  • 2
LVL 15

Accepted Solution

Computron earned 1000 total points
ID: 16289618
LVL 15

Expert Comment

ID: 16289629

Author Comment

ID: 16290961
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.


Assisted Solution

glass_cookie earned 1000 total points
ID: 16318074

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

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 =)

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question