how?

technix

Active Member
Joined
May 19, 2002
Messages
326
Lets assume in c:foldername I have the file name creationdate.txt
CreationDate.txt containes the following text including the "'s

"Folder was created : 9/29/2002 1:56:01 PM"

How would I inport just the date 9/29/2002 into a variable?

Derrick
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Oh, THIS is easy (but if you remove the colon, I ain't helping you).

ColonPos=Instr(1,LookInThisStr,":")

LengthOfDate= Len(..... you get the idea....

TheDate=mid(LookInThisStr,ColonPos,LengthOfDate)

I am reluctant to supply fully-finished code, unless the specifications are chisled in stone. I will offer hints, however.


If you want to bring this topic to the top of the list, just reply to your own thread.
DO NOT create a second thread.
This message was edited by stevebausch on 2002-09-29 12:17
 
Upvote 0
On 2002-09-29 12:14, stevebausch wrote:
Oh, THIS is easy (but if you remove the colon, I ain't helping you).

ColonPos=Instr(1,LookInThisStr,":")

LengthOfDate= Len(..... you get the idea....

TheDate=mid(LookInThisStr,ColonPos,LengthOfDate)

I am reluctant to supply fully-finished code, unless the specifications are chisled in stone. I will offer hints, however.


If you want to bring this topic to the top of the list, just reply to your own thread.
DO NOT create a second thread.
This message was edited by stevebausch on 2002-09-29 12:17

Thank you, How do I get it to read from the file though?

If that was in a range I could understand it, I want it to read the date from the text file and store it into a variable

Derrick
 
Upvote 0
This question was asked a while ago however, I never received a completed answer to help me, So I am bringing it back to see If i can get the help now

my Question is How do I Excel to open the textfile for input and then using steves example get the data and then close the file

That you in Advance for your help

Derrick
 
Upvote 0
On 2002-10-28 14:41, technix wrote:
This question was asked a while ago however, I never received a completed answer to help me, So I am bringing it back to see If i can get the help now

my Question is How do I Excel to open the textfile for input and then using steves example get the data and then close the file

That you in Advance for your help

Derrick

I have this example from the Help but I am still confused in how to incorporate this to my situation, Thank you

Code:
Open "TESTFILE" For Input As #1
' Close before reopening in another mode.
Close #1

Derrick
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top