PC Review


Reply
Thread Tools Rate Thread

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

 
 
Excel 009
Guest
Posts: n/a
 
      2nd Nov 2006
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

 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      3rd Nov 2006

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" <(E-Mail Removed)>
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

 
Reply With Quote
 
Excel 009
Guest
Posts: n/a
 
      3rd Nov 2006
Thanks, Jim, but the autofill still does not come up.

Do it come up on your computer?

- 009

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      3rd Nov 2006
Do you mean what appears for Office files ?
If so, then
http://www.cpearson.com/excel/docprop.htm

NickHK

"Excel 009" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      3rd Nov 2006
Under Tools | Options | Editor (tab)...
'Auto List Members' must be checked.
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html


"Excel 009" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Thanks, Jim, but the autofill still does not come up.

Do it come up on your computer?

- 009

 
Reply With Quote
 
Excel 009
Guest
Posts: n/a
 
      3rd Nov 2006

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

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      3rd Nov 2006
But can the FSO read OLE document properties ?

NickHK

"Excel 009" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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
>



 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      3rd Nov 2006
Check out this from MS...
http://www.microsoft.com/technet/scr....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" <(E-Mail Removed)>
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

 
Reply With Quote
 
Excel 009
Guest
Posts: n/a
 
      3rd Nov 2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CreateObject("Scripting.FileSystemObject") Baracudo Microsoft Access VBA Modules 2 23rd Apr 2008 05:55 AM
CreateObject("Scripting.FileSystemObject") stopped working =?Utf-8?B?QW5kcmV3IEhhbGwgTlo=?= Microsoft Outlook VBA Programming 2 15th Feb 2007 09:25 PM
Error 429 VBA.Interaccion.Createobject("Scripting.FileSystemObject =?Utf-8?B?Y2FqaW5hbWFzdGVy?= Microsoft Excel Programming 2 14th Feb 2007 02:49 PM
XP SP2 breaks .NET .dll load via Server.CreateObject("scripting.fileSystemObject") chsmith@speakeasy.net Microsoft ASP .NET 1 29th Mar 2006 03:29 AM
ActiveX warning on CreateObject("Scripting.FileSystemObject") Bill Gauthier Windows XP Security 0 12th Dec 2003 04:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 PM.