How can I get the author of a file using CreateObject("Scripting.FileSystemObject")?

E

Excel 009

Hi All,

I need to use the following method to get the author name. Is it
doable? Also, how can I get all the available properties or members
under f1? Why is it that when I type "f1.", the autofill (auto list
member) does not come up?

- 009

Dim f1 As Object
Dim fs As Object
Dim str As String

fileSpec = "C:\TEST\123.zip"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f1 = fs.GetFile(fileSpec)

str = "Last Modified Date" & vbTab & f1.DateLastModified & vbCrLf
str = str & "Last Accessed Date" & vbTab & f1.DateLastAccessed &
vbCrLf
str = str & "Created Date" & vbTab & f1.DateCreated

MsgBox str
 
J

Jim Cone

Set a reference to the "MicrosoftScriptingRuntime" library in Tools | References.
Then you will be able to get the "autolist" feature.
Your code could look something like...

Sub ABC()
Dim oFS As Scripting.FileSystemObject
Dim oF1 As Scripting.File
Set oFS = New Scripting.FileSystemObject
'...
End Sub

The FileSystemObject File object does not have an author property.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Excel 009" <[email protected]>
wrote in message
Hi All,
I need to use the following method to get the author name. Is it
doable? Also, how can I get all the available properties or members
under f1? Why is it that when I type "f1.", the autofill (auto list
member) does not come up?
- 009

Dim f1 As Object
Dim fs As Object
Dim str As String

fileSpec = "C:\TEST\123.zip"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f1 = fs.GetFile(fileSpec)

str = "Last Modified Date" & vbTab & f1.DateLastModified & vbCrLf
str = str & "Last Accessed Date" & vbTab & f1.DateLastAccessed &
vbCrLf
str = str & "Created Date" & vbTab & f1.DateCreated

MsgBox str
 
E

Excel 009

Thanks, Jim, but the autofill still does not come up.

Do it come up on your computer?

- 009
 
E

Excel 009

Yes, Jim, the 'Auto List Members box is checked, but not auto list.

Nick, I do not want to use the method that needs to install "DS: OLE
Document Properties 1.2 Object Library" in order for the author name to
come up. Imagine if you are writing a program for 100 users. I do not
want to get into the package/distribution issue.

- 009
 
J

Jim Cone

Check out this from MS...
http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_lunl.mspx?mfr=true
"Retrieving Extended File Properties"
It requires a project reference to Microsoft Shell Controls and Automation
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Excel 009" <[email protected]>
wrote in message

Yes, Jim, the 'Auto List Members box is checked, but not auto list.

Nick, I do not want to use the method that needs to install "DS: OLE
Document Properties 1.2 Object Library" in order for the author name to
come up. Imagine if you are writing a program for 100 users. I do not
want to get into the package/distribution issue.

- 009
 
E

Excel 009

Thanks Jim!

The refererce works perfectly.

Here is the code for everyone. I change original wsscript.echo to
debug.print.


Sub GetAttribute()
Dim arrHeaders(35)
Set objShell = CreateObject("Shell.Application")
'Set objFolder = objShell.Namespace("C:\Scripts")

For i = 0 To 34
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next

For Each strFileName In objFolder.Items
For i = 0 To 34
Debug.Print i & vbTab & arrHeaders(i) _
& ": " & objFolder.GetDetailsOf(strFileName, i)
Next
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top