Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way of entering into cells (below each other)
1. The name of the file 2. Last person who saved the file 3. Last person accessed the file 4. Date and time last saved? Help greatly appreciated John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can get the name of the file with
ThisWorkbook.Name 'or ThisWorkbook.FullName. You can get the original author of the file with ThisWorkbook.BuiltInDocumentProperties("Author").V alue You can get the last-saved-by user with ThisWorkbook.BuiltInDocumentProperties("Last Author").Value These two values return the name that is entered as the "User Name" in the Options dialog box. This is not the user's logon id. You can get the last save time with FileDateTime(ThisWorkbook.FullName) Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sat, 29 Nov 2008 09:39:01 -0800, JohnUK wrote: Is there a way of entering into cells (below each other) 1. The name of the file 2. Last person who saved the file 3. Last person accessed the file 4. Date and time last saved? Help greatly appreciated John |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks Chip, but I am not sure how I would enter that into a code so
that it would paste those values into the cells of a worksheet. John "Chip Pearson" wrote: You can get the name of the file with ThisWorkbook.Name 'or ThisWorkbook.FullName. You can get the original author of the file with ThisWorkbook.BuiltInDocumentProperties("Author").V alue You can get the last-saved-by user with ThisWorkbook.BuiltInDocumentProperties("Last Author").Value These two values return the name that is entered as the "User Name" in the Options dialog box. This is not the user's logon id. You can get the last save time with FileDateTime(ThisWorkbook.FullName) Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sat, 29 Nov 2008 09:39:01 -0800, JohnUK wrote: Is there a way of entering into cells (below each other) 1. The name of the file 2. Last person who saved the file 3. Last person accessed the file 4. Date and time last saved? Help greatly appreciated John |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You enter it into a worksheet by making a variable equal to the return value
of the built in properties: userName = ThisWorkbook.BuiltInDocumentProperties("Author").V alue ActiveSheet.ActiveCell = userName "JohnUK" wrote: Many thanks Chip, but I am not sure how I would enter that into a code so that it would paste those values into the cells of a worksheet. John "Chip Pearson" wrote: You can get the name of the file with ThisWorkbook.Name 'or ThisWorkbook.FullName. You can get the original author of the file with ThisWorkbook.BuiltInDocumentProperties("Author").V alue You can get the last-saved-by user with ThisWorkbook.BuiltInDocumentProperties("Last Author").Value These two values return the name that is entered as the "User Name" in the Options dialog box. This is not the user's logon id. You can get the last save time with FileDateTime(ThisWorkbook.FullName) Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sat, 29 Nov 2008 09:39:01 -0800, JohnUK wrote: Is there a way of entering into cells (below each other) 1. The name of the file 2. Last person who saved the file 3. Last person accessed the file 4. Date and time last saved? Help greatly appreciated John |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry - I am at a loss with this one
"JLGWhiz" wrote: You enter it into a worksheet by making a variable equal to the return value of the built in properties: userName = ThisWorkbook.BuiltInDocumentProperties("Author").V alue ActiveSheet.ActiveCell = userName "JohnUK" wrote: Many thanks Chip, but I am not sure how I would enter that into a code so that it would paste those values into the cells of a worksheet. John "Chip Pearson" wrote: You can get the name of the file with ThisWorkbook.Name 'or ThisWorkbook.FullName. You can get the original author of the file with ThisWorkbook.BuiltInDocumentProperties("Author").V alue You can get the last-saved-by user with ThisWorkbook.BuiltInDocumentProperties("Last Author").Value These two values return the name that is entered as the "User Name" in the Options dialog box. This is not the user's logon id. You can get the last save time with FileDateTime(ThisWorkbook.FullName) Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sat, 29 Nov 2008 09:39:01 -0800, JohnUK wrote: Is there a way of entering into cells (below each other) 1. The name of the file 2. Last person who saved the file 3. Last person accessed the file 4. Date and time last saved? Help greatly appreciated John |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'll pass this along for reference anyhow. I got it on the en.allexperts.com
site. Remarks This property returns the entire collection of built-in document properties. Use the Item method to return a single member of the collection (a DocumentProperty object) by specifying either the name of the property or the collection index (as a number). You can refer to document properties either by index value or by name. The following list shows the available built-in document property names: Title Subject Author Keywords Comments Template Last Author Revision Number Application Name Last Print Date Creation Date Last Save Time Total Editing Time Number of Pages Number of Words Number of Characters Security Category Format Manager Company Number of Bytes Number of Lines Number of Paragraphs Number of Slides Number of Notes Number of Hidden Slides Number of Multimedia Clips Hyperlink Base Number of Characters (with spaces) Container applications aren't required to define values for every built-in document property. If Microsoft Excel doesn't define a value for one of the built-in document properties, reading the Value property for that document property causes an error. "JohnUK" wrote: Sorry - I am at a loss with this one "JLGWhiz" wrote: You enter it into a worksheet by making a variable equal to the return value of the built in properties: userName = ThisWorkbook.BuiltInDocumentProperties("Author").V alue ActiveSheet.ActiveCell = userName "JohnUK" wrote: Many thanks Chip, but I am not sure how I would enter that into a code so that it would paste those values into the cells of a worksheet. John "Chip Pearson" wrote: You can get the name of the file with ThisWorkbook.Name 'or ThisWorkbook.FullName. You can get the original author of the file with ThisWorkbook.BuiltInDocumentProperties("Author").V alue You can get the last-saved-by user with ThisWorkbook.BuiltInDocumentProperties("Last Author").Value These two values return the name that is entered as the "User Name" in the Options dialog box. This is not the user's logon id. You can get the last save time with FileDateTime(ThisWorkbook.FullName) Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sat, 29 Nov 2008 09:39:01 -0800, JohnUK wrote: Is there a way of entering into cells (below each other) 1. The name of the file 2. Last person who saved the file 3. Last person accessed the file 4. Date and time last saved? Help greatly appreciated John |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code I posted was VBA code, not formula code. You need to create a
User Defined Function in VBA. Press ALT F11 to open the VBA Editor (VBE). There, press CTRL R to display the Project Explorer window if it is not already visible (typically on the left side of the screen). Find your project workbook in the Project Explorer, select it, then go to the Insert menu and choose Module. This will create a code module named Module1 in your workbook's VBA Project. In that module, enter the following code: Function GetProp(PropName As String, _ Optional Reference As Excel.Range) As Variant On Error GoTo ErrH: Dim DocProps As Office.DocumentProperties Dim WB As Excel.Workbook If Reference Is Nothing Then Set WB = ThisWorkbook Else Set WB = Reference.Parent.Parent End If Set DocProps = _ WB.BuiltinDocumentProperties GetProp = CStr(DocProps(PropName).Value) Exit Function ErrH: GetProp = CVErr(xlErrValue) End Function Now, close the VBE. Back in Excel, you can call this function from a cell with a function like =GetProp("Author") Change "Author" to the name of the property whose value you want to return. If the property doesn't exist or isn't set, the function returns a #VALUE error. If Reference is not specified, the property is read from the workbook that contains the code. To look up a property in another (open) workbook, pass a reference to that workbook as the Reference. For example, to get the Author property of Book3.xls, use =GetProp("Author",[Book3.xls]Sheet1!A1) It doesn't matter what reference you pass to GetProp as long as it refers to a cell in the workbook whose properties you want to retrieve. Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sat, 29 Nov 2008 10:03:01 -0800, JohnUK wrote: Many thanks Chip, but I am not sure how I would enter that into a code so that it would paste those values into the cells of a worksheet. John "Chip Pearson" wrote: You can get the name of the file with ThisWorkbook.Name 'or ThisWorkbook.FullName. You can get the original author of the file with ThisWorkbook.BuiltInDocumentProperties("Author").V alue You can get the last-saved-by user with ThisWorkbook.BuiltInDocumentProperties("Last Author").Value These two values return the name that is entered as the "User Name" in the Options dialog box. This is not the user's logon id. You can get the last save time with FileDateTime(ThisWorkbook.FullName) Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sat, 29 Nov 2008 09:39:01 -0800, JohnUK wrote: Is there a way of entering into cells (below each other) 1. The name of the file 2. Last person who saved the file 3. Last person accessed the file 4. Date and time last saved? Help greatly appreciated John |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For item #3, use:
Environ("username") -- Gary''s Student - gsnu200816 "JohnUK" wrote: Is there a way of entering into cells (below each other) 1. The name of the file 2. Last person who saved the file 3. Last person accessed the file 4. Date and time last saved? Help greatly appreciated John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I recover an Excel document saved not saved as | Excel Discussion (Misc queries) | |||
i "saved" instead of "saved as". I need old file back | Excel Discussion (Misc queries) | |||
Why is Referenced Workbook Saved When ActiveWorkbook is Saved? | Excel Programming | |||
How can I see a copy of a saved workbook before I saved it again? | Excel Worksheet Functions | |||
How to get saved old saved work that was saved over? | Excel Discussion (Misc queries) |