vba code to find original file information?

N_Mitch

Board Regular
Joined
Jan 23, 2007
Messages
146
G'day,

Is there any code which can display the original file information? The type of information I need is as follows:

File location
Date
Excel version
Created by whom

Thank you,

Mitch
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

iggydarsa

Well-known Member
Joined
Jun 28, 2005
Messages
1,647
dont know about date and crated by whom but following code shows the file location and excel version

Code:
Sub ShowInfo()
MsgBox "File location: " & ThisWorkbook.Path & Chr(13) & _
"Version: " & Application.Version
End Sub
 

iggydarsa

Well-known Member
Joined
Jun 28, 2005
Messages
1,647
and this is the creation date:

Code:
Sub ShowInfo() 
MsgBox "File location: " & ThisWorkbook.Path & Chr(13) & _ 
"Version: " & Application.Version & chr(13) & _
"Creation Date: " & FileDateTime(ThisWorkbook.Path & "\" & ThisWorkbook.Name)
End Sub
 

N_Mitch

Board Regular
Joined
Jan 23, 2007
Messages
146
Thanks iggydarsa

However, what I want to know is the original file location where the file was created in. I'm not sure if this information is stored in a file or not.

In other words, even where a file has been copied, or SavedAs, to a new location, is there some vba code that can display the original file location?

Thanks,

Mitch
 

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985

ADVERTISEMENT

This code should give the info:
Code:
Sub ListStuff()
    Range("B3").Value = "Workbook Path"
    Range("B4").Value = "File Creation Date"
    Range("B5").Value = "Application Version"
    Range("B6").Value = "Created by:"
    
    Range("C3").Value = ActiveWorkbook.Path
    Range("C4").Value = ThisWorkbook.BuiltinDocumentProperties(11).Value
    Range("C5").Value = Application.Version
    Range("C6").Value = ThisWorkbook.BuiltinDocumentProperties(3).Value
End Sub
 

N_Mitch

Board Regular
Joined
Jan 23, 2007
Messages
146
Excellent!

That was just what I was after, John (although I would have really liked the orig file location as well!).

Thanks,

Mitch
 

Watch MrExcel Video

Forum statistics

Threads
1,129,592
Messages
5,637,291
Members
416,963
Latest member
zazama

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
Top