From: webels on
Hi
As part of an error checking control step I would like to add some VBA
to a Macro which requires extracting the date of modification of a
text file.

Specifically I want to read the date modified property of an
external .txt file before continuing to import the data from that
file into my current workbook.

If this date modified property does not equal Todays date (Today()) I
want a message box to appear saying the File will not be imported as
it was not modified Today. I then want the Macro to be terminated. If
it does equal todays date - no message box and continue with the rest
of the Macro code.

Would anyone be able to help me with the coding of this

Thanks
Eddie
From: sali on
"webels" <eidde1(a)gmail.com> je napisao u poruci interesnoj
grupi:2ed24796-acf6-401b-93ce-885f23413908(a)r27g2000yqn.googlegroups.com...
> Hi
> As part of an error checking control step I would like to add some VBA
> to a Macro which requires extracting the date of modification of a
> text file.


there is vba function 'filedatetime(filename)' which returns the date-time
of a specified file-name, so you may process it as you want


From: webels on
On Apr 19, 5:02 pm, "sali" <s...(a)euroherc.hr> wrote:
> "webels" <eid...(a)gmail.com> je napisao u poruci interesnoj
> grupi:2ed24796-acf6-401b-93ce-885f23413...(a)r27g2000yqn.googlegroups.com....
>
> > Hi
> > As part of an error checking control step I would like to add some VBA
> > to a Macro which requires extracting the date of modification of a
> > text file.
>
> there is vba function 'filedatetime(filename)' which returns the date-time
> of a specified file-name, so you may process it as you want

Thanks Sali
Will this give me the modified time of the file?
Or will it return the created date?

Thanks for your help
Eddie
From: Rick Rothstein on
The help files says "Returns a Variant (Date) that indicates the date and
time when a file was created or last modified", so if the file were
modified, then that is the date that is returned. By the way, it is always a
good idea to read the help files about any new command you hear about (while
not the case here, there could be optional arguments that would be handy to
know about). The easiest way to get to the help file for a particular
command is to put the cursor on it (if you do not have it in code yet, just
type it into the Immediate Window) and press F1.

--
Rick (MVP - Excel)



"webels" <eidde1(a)gmail.com> wrote in message
news:f96703bb-b9b3-4d80-ac30-d4d5f98087fe(a)r11g2000vbc.googlegroups.com...
> On Apr 19, 5:02 pm, "sali" <s...(a)euroherc.hr> wrote:
>> "webels" <eid...(a)gmail.com> je napisao u poruci interesnoj
>> grupi:2ed24796-acf6-401b-93ce-885f23413...(a)r27g2000yqn.googlegroups.com...
>>
>> > Hi
>> > As part of an error checking control step I would like to add some VBA
>> > to a Macro which requires extracting the date of modification of a
>> > text file.
>>
>> there is vba function 'filedatetime(filename)' which returns the
>> date-time
>> of a specified file-name, so you may process it as you want
>
> Thanks Sali
> Will this give me the modified time of the file?
> Or will it return the created date?
>
> Thanks for your help
> Eddie

From: webels on
On Apr 19, 9:43 pm, "Rick Rothstein"
<rick.newsNO.S...(a)NO.SPAMverizon.net> wrote:
> The help files says "Returns a Variant (Date) that indicates the date and
> time when a file was created or last modified", so if the file were
> modified, then that is the date that is returned. By the way, it is always a
> good idea to read the help files about any new command you hear about (while
> not the case here, there could be optional arguments that would be handy to
> know about). The easiest way to get to the help file for a particular
> command is to put the cursor on it (if you do not have it in code yet, just
> type it into the Immediate Window) and press F1.
>
> --
> Rick (MVP - Excel)
>
> "webels" <eid...(a)gmail.com> wrote in message
>
> news:f96703bb-b9b3-4d80-ac30-d4d5f98087fe(a)r11g2000vbc.googlegroups.com...
>
>
>
> > On Apr 19, 5:02 pm, "sali" <s...(a)euroherc.hr> wrote:
> >> "webels" <eid...(a)gmail.com> je napisao u poruci interesnoj
> >> grupi:2ed24796-acf6-401b-93ce-885f23413...(a)r27g2000yqn.googlegroups.com...
>
> >> > Hi
> >> > As part of an error checking control step I would like to add some VBA
> >> > to a Macro which requires extracting the date of modification of a
> >> > text file.
>
> >> there is vba function 'filedatetime(filename)' which returns the
> >> date-time
> >> of a specified file-name, so you may process it as you want
>
> > Thanks Sali
> > Will this give me the modified time of the file?
> > Or will it return the created date?
>
> > Thanks for your help
> > Eddie

Thanks Rick looks good and thanks for the advice and again thanks sali
for the pointer