Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

reading and modifying file comments

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
idyllicabyss@googlemail.com - 24 Mar 2006 01:27 GMT
I can access most of a files attributes and info using FSO commands but
this does not give me acces to the Comments properties.
Can anyone help? Ideally I want to be able to modify the Comments as
well.
My current code is listed below.

Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder
Dim FileItem As Scripting.File
Dim r As Long
   Set FSO = New Scripting.FileSystemObject
   Set SourceFolder = FSO.GetFolder(SourceFolderName)
   r = Range("A65536").End(xlUp).Row + 1
   For Each FileItem In SourceFolder.Files
       Cells(r, 1).Formula = Left(FileItem.Path, Len(FileItem.Path) -
Len(FileItem.Name) - 1)
       Cells(r, 2).Formula = FileItem.Name
       Cells(r, 5).Formula = FileItem.Size
       Cells(r, 6).Formula = FileItem.Type
       Cells(r, 7).Formula = FileItem.DateCreated
       Cells(r, 8).Formula = FileItem.DateLastAccessed
       Cells(r, 9).Formula = FileItem.DateLastModified
       Cells(r, 10).Formula = FileItem.Attributes
       Cells(r, 11).Formula = FileItem.Comments   ' Comments Doesn't
work
       Cells(r, 12).Formula = FileItem.ShortPath & FileItem.ShortName
next FileItem
kletcho@gmail.com - 24 Mar 2006 08:10 GMT
Are you creating a VB script that runs outside of Excel or are you in
Excel running this procedure?  If you are creating a VB script I would
create and Excel Object and then access the comments through that
object and go from there as you normally would if programming in VBA.

Dim xlApp
Dim xlBook
Dim strFileName

strFileName = "c:\MyFile.xls"
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.WorkBooks.Open(filename)

Range("A1").Comments.Text = "Hello"

If you are programming in VBA and in excel then you can just skip the
first part and just use Range("A1").Comments.Text = "Hello".
idyllicabyss@googlemail.com - 24 Mar 2006 12:39 GMT
The Comments I want are the ones visible when you right click a file in
explorer amd choose Properties.
Specifically they are comments that have been appended to .ZIP archives
and .7z archives.

I can do this for Excel and other office files using Chip Pearson's
guide but it doesn't work for non OLE files.
Kletcho - 24 Mar 2006 19:41 GMT
Sorry I misunderstood. I don't think the FSO file object has that
property.  I think you already have all the available properties in
your code.

I don't know how well it would translate to VBA, but here is a thought
through VB.net --
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/v
bnet07232002.asp

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.